Subject: Re: [xsl] group by tags From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Mon, 23 Jun 2008 14:24:57 +0200 |
I need group by tags this xml for example. The problem is that I dont know the name of the tags. Only I know the tag "Book" and the ID "boo2"
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" version="2.0">
<xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template>
<xsl:template match="Book[@rdf:ID = 'boo2']"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:for-each-group select="*" group-by="name()"> <xsl:element name="{current-grouping-key()}"> <xsl:copy-of select="@* | text()"/> <xsl:for-each-group select="current-group()/*" group-by="name()"> <xsl:element name="{current-grouping-key()}"> <xsl:copy-of select="current-group()/*"/> </xsl:element> </xsl:for-each-group> </xsl:element> </xsl:for-each-group> </xsl:copy> </xsl:template>
Martin Honnen http://JavaScript.FAQTs.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] group by tags, IZASKUN GUTIERREZ GU | Thread | [xsl] Transforming double quotes, Aaron Johnson |
[xsl] group by tags, IZASKUN GUTIERREZ GU | Date | [xsl] Transforming double quotes, Aaron Johnson |
Month |