xsl-list
[Top] [All Lists]

[xsl] Missing a template, I think

2007-03-26 19:20:18
Hello everyone, I'm trying to build a stylesheet to translate XML generated
by Freemind, a mind-mapping application which organizes text into many
levels of nodes, all conveniently named "node", like this:

MAP
--Node
--Node
------Node
----------Node
----------Node
------Node
--Node

The way I use Freemind, the second to deepest node is always named "R" and a
number, like this:

MAP
--Node
--Node
------Node @TEXT=R1
----------Node
----------Node
------Node @TEXT=R2
----------Node
----------Node
--Node

For my stylesheet, I'm lumping similar "R" nodes together, underneath the
node path to reach it, with this code:

<xsl:template match="node[starts-with(*/@TEXT, 'R') and
number(substring(*/@TEXT,2,1))]">
                <h1>
            <xsl:for-each select="ancestor-or-self::*">
            <xsl:if test="position() > 2"> | <xsl:value-of
select="@TEXT"/></xsl:if>
            </xsl:for-each>
                </h1>
        <xsl:apply-templates/>
</xsl:template>


And I'm styling the "R" node itself with this code:


<xsl:template match="node[(*) and (not(*/*))]">
<p><xsl:value-of select="@TEXT"/></p>
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>


And lastly, I'm styling the last nodes in the hierarchy with this code:


<xsl:template match="node[not(*)]">
<li><xsl:value-of select="@TEXT"/></li>
</xsl:template>


This works fine with every situation, producting output like this:

Node | Node | Node
R1
(final node text)

Except with nodes that contain sub-nodes AND "R" nodes, like this:

MAP
--Node
--Node
------Node @TEXT=R1
----------Node
----------------Node @TEXT=R1
 ---------------------Node

 For some reason, they don't parse, and I just don't know why. Can anyone
share any insight why my code isn't working? It's driving me crazy!

thanks


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>