[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Missing a template, I think

Subject: Missing a template, I think
From: "Robert Hamburger" <rhamburger@xxxxxxxxxxxxxxx>
Date: Mon, 26 Mar 2007 22:19:54 -0400
 Missing a template
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.