[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Identity Transform Grouping Question
ethan.kalfus@xxxxxxx wrote:
<xsl:key name="offices" match="office" use="concat(cities/city[@lang='en'],'-',names/name[@lang='en'])"/> ... <!-- reorganize 'country' elements --> <xsl:template match="country"> <country> <xsl:copy-of select="@*"/> <cities> <!-- group 'city' elements within this country --> <xsl:variable name="offices-in-this-country"> <xsl:copy-of select="offices"/> <!-- this is a trick, to restrict all subsequent key usage to this country only --> </xsl:variable> <xsl:apply-templates select="msxsl:node-set($offices-in-this-country)/offices/office/cities[count(.|key('cities',city[@lang='en'])[1])=1]"> <xsl:sort select="city[@lang='en']"/> </xsl:apply-templates> </cities> </country> </xsl:template> Hi Ethan, Why use the node-set function here if you could use a key as well? <xsl:key name="offices-by-country" match="office" use="ancestor::country/@name"/> Or am I missing something? Grtz, Geert
|
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
|