Subject: Re: [xsl] [xpath] all following sibling nodes upto first occurace of specific text value From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Thu, 11 Aug 2005 14:50:55 +0200 |
Hi, Tempore 14:33:33, die 08/11/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit geoff hopkins <geoffhopkins123@xxxxxxxxx>:
I understand this is a xslt forum but there does not seem to be any decent xpath places... I need a xpath expression to be used with a for-each loop... context node is X.Parent select the next items until it finds the next occurance of X.Parent or END-OF-DATA as the text value of the node
<xsl:key name="children" match="node[not(.='END-OF-DATA' or .='X.Parent')]" use="generate-id(preceding::node[.='X.Parent'][1])"/>
<xsl:template match="root"> <xsl:apply-templates select="node[.='X.Parent']"/> </xsl:template>
<xsl:template match="node"> <xsl:element name="{.}"> <xsl:apply-templates select="key('children',generate-id())"/> </xsl:element> </xsl:template>
The output will be: <X.Parent> <Y.Child/> <Y.Child/> </X.Parent> <X.Parent> <Y.Child/> </X.Parent>
regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Fiat W3C in tenebris
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [xpath] all following sibling, geoff hopkins | Thread | RE: [xsl] [xpath] all following sib, Michael Kay |
[xsl] [xpath] all following sibling, geoff hopkins | Date | RE: [xsl] Evaluating XSLT2 from cod, Andrew Sharpe |
Month |