Re: [xsl] generic sort based on attribute names

Subject: Re: [xsl] generic sort based on attribute names
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Wed, 26 Jan 2005 21:17:59 +0100
Tempore 00:40:28, die 01/26/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Chaitanya Desai <cdesai@xxxxxxxxxxx>:

I am still not getting the desired output.
Oops, little mistake in the predicate:

<xsl:template match="*">
<xsl:variable name="sortkey">
<xsl:for-each select="*">
<e>
<xsl:for-each select="@*">
<xsl:sort select="name(.)"/>
<xsl:value-of select="name()"/>
</xsl:for-each>
</e>
</xsl:for-each>
</xsl:variable>
<xsl:copy>
<xsl:for-each select="@*">
<xsl:sort select="name(.)"/>
<xsl:copy-of select="."/>
</xsl:for-each>
<xsl:apply-templates>
<!-- the select for this sort needs to be the concatenated name-value pairs of
all the attributes sorted in alphabetical order -->
<xsl:sort select="xx:node-set($sortkey)//e[position()=count(current()/preceding-sibling::*)]"/>
should have been:
<xsl:sort select="xx:node-set($sortkey)//e[position()=count(current()/preceding-sibling::*)+1]"/>
		</xsl:apply-templates>
	</xsl:copy>
</xsl:template>


regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Vincit omnia simplicitas
Keep it simple

Current Thread