xsl-list
[Top] [All Lists]

Re: generic sort based on attribute names

2005-01-26 13:17:59
Tempore 00:40:28, die 01/26/2005 AD, hinc in xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Chaitanya Desai <cdesai(_at_)syncata(_dot_)com>:

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

--~------------------------------------------------------------------
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>
--~--