xsl-list
[Top] [All Lists]

dynamic sorting

2004-02-05 08:02:12
Hello all,

I'm breaking my head on some problem, and I hope you can help me with it.

Imagine the following part of an xml file:

<person>
        <fname>Jup</fname>
        <lname>Nope</lname>
        <bday>Also</bday>
        ...
</person

The following works perfect:

<xsl:template match="/">
        <xsl:apply-templates select="person">
                <xsl:sort select="person/fname"/
        </xsl:apply-templates>
</xsl:template>

But when I put the string "person" into a parameter named "sort", it doesn't
work anymore:

<xsl:template match="/">
        <xsl:param name="sort">person</xsl:param>
        <xsl:apply-templates select="$sort">
                <xsl:sort select="person/fname"/
        </xsl:apply-templates>
</xsl:template>

My goal is that the user of my xsl file can give a parameter "sort" (to his
xslt parser) which defines his preferred way of sorting.

Any ideas what is wrong?

Thanks a lot,

--
Peter


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list