Hi,
Tempore 14:33:33, die 08/11/2005 AD, hinc in
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit geoff hopkins
<geoffhopkins123(_at_)yahoo(_dot_)com>:
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
Keys are often used to achieve something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:key name="children"
match="node[not(.='END-OF-DATA' or .='X.Parent')]"
use="generate-id(preceding::node[.='X.Parent'][1])"/>
<xsl:output method="xml" indent="yes"/>
<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>
</xsl:stylesheet>
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
--~------------------------------------------------------------------
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>
--~--