[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Taking flat XML and parsing into multi level nexte
Hello Paul, I just tried to find a solution for your problem in XSLT 1.0, and I came up with this: <xsl:stylesheet version="1.0" xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:template match="/root" > <root> <xsl:apply-templates select="*[1]" /> </root> </xsl:template> <xsl:template match="item"> <item> <title><xsl:value-of select="text()" /></title> </item> <xsl:apply-templates select="following-sibling::*[1][not(self::categoryEnd)]" /> </xsl:template> <xsl:template match="categoryStart"> <xsl:variable name="thisName" select="text()" /> <group> <title><xsl:value-of select="text()" /></title> <xsl:apply-templates select="following-sibling::*[1][not(self::categoryEnd)]" /> </group> <xsl:apply-templates select="following-sibling::*[preceding-sibling::*[1][self::categoryEnd and text() = $thisName]]" /> </xsl:template> <xsl:template match="*" /> </xsl:stylesheet> I hope this doesn't induce "hurting eyes" to some of the professionals here, but it does the work with the given sample input. Greetings Christoph If you are not the intended addressee, please inform us immediately that you have received this e-mail by mistake and delete it. We thank you for your support.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|