Subject: Re: [xsl] Choosing different sorts From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx> Date: Thu, 15 Jul 2004 00:57:32 -0700 (PDT) |
Hi Derek, <xsl:sort select="*[name(.) = $sortfield]"/> is the correct way. The predicate [name(.) = $sortfield] makes the above xsl:sort syntax equivalent to <xsl:sort select="name"/> ,if $sortfield equals to name <xsl:sort select="status"/> ,if $sortfield equals to status <xsl:sort select="id"/> ,if $sortfield equals to id Your xsl:choose syntax is invalid, and shall throw an error "xsl:sort not allowed at this place". xsl:sort should be direct child of xsl:apply-templates or xsl:for-each Regards, Mukul --- Derek Hohls <DHohls@xxxxxxxxxx> wrote: > I had a look in the archives before posting, and am > not sure I understand the method which uses: > > <xsl:sort select="*[name(.) = $sortfield]"/> > > I have tried, in my code to have: > > <xsl:for-each select="file"> > <xsl:choose> > <xsl:when test="$sort='design'"><xsl:sort > select="name"/></xsl:when> > <xsl:when test="$sort='stat'"><xsl:sort > select="status"/></xsl:when> > <xsl:otherwise><xsl:sort > select="id"/></xsl:otherwise> > > </xsl:choose> > > where $sort is a parameter passed in (via another > web page). > (NB: the actual select fields are quite long path > strings...) > > but this is clearly wrong! > > Any guidance on this area would be welcome. > > Thanks > Derek __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Choosing different sorts, Derek Hohls | Thread | Re: [xsl] Choosing different sorts, Jeni Tennison |
[xsl] generating an HTML web hiera, Arulraj | Date | [xsl] Matching similar rows in a ta, Aadjan van der Helm |
Month |