Subject: [xsl] preceding sibling headaches From: Paul Tremblay <phthenry@xxxxxxxxxxxxx> Date: Tue, 22 Apr 2003 15:24:15 -0400 |
I can't understand how to use preceding sibling, despite the two books I have on xslt. Here is my original XML file: <paragraph>A paragraph</paragraph> <transition/> <paragraph>A pargraph after a transition</paragraph> I want to transform this to: <p>A paragraph</p> <p rend = "transition">A paragrah after transition</p> Here is en excerpt form my unsuccessful code: <xsl:template match = "paragraph"> <xsl:choose> <xsl:when test = "preceding-sibling::transition[1]"> <p rend="transition"> <xsl:apply-templates/> </p> </xsl:when> <xsl:otherwise> <p> <xsl:apply-templates/> </p> </xsl:otherwise> </xsl:choose> </xsl:template> This transformation turns *all* paragraphs after a </transtion> into <p rend ="transtion">. What I want to say is something like "if the preceeding sibling's element name is 'transtion', do something. Doing this with ancestors and descendants is usually pretty easy to figure out. But preceeding sibling really has me stumped! Thanks Paul -- ************************ *Paul Tremblay * *phthenry@xxxxxxxxxxxxx* ************************ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Re: Grouping problem?, Dimitre Novatchev | Thread | Re: [xsl] preceding sibling headach, Rick Taylor |
RE: [xsl] Character entities in att, mark_fletcher | Date | Re: [xsl] Selecting text bisected b, Gan Uesli Starling |
Month |