Subject: [xsl] Missing a template, I think From: "Robert Hamburger" <rhamburger@xxxxxxxxxxxxxxx> Date: Mon, 26 Mar 2007 22:19:54 -0400 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] What's wrong with my ance, Mulberry Technologie | Thread | Re: [xsl] Missing a template, I thi, Abel Braaksma |
Res: [xsl] org.apache.xpath.objects, Lepoldo Melo | Date | Re: [xsl] Missing a template, I thi, Abel Braaksma |
Month |