xsl-list
[Top] [All Lists]

RE: Parameterized sort

2003-04-01 06:46:03
Hi Kim,

I have the following sort problem where I want to have the 
sort key defined 
as a parameter.
  ...
<document>
<row><column name="FirstName">John</column>
      <column name="LastName">Doo</column>
</row>
<row><column name="FirstName">Alice</column>
      <column name="LastName">Mulcaster</column>
</row>
  ...
<xsl:sort select="column[(_at_)name=*[name()=$sortByColumn]]"/>


Your problem is that you are trying to treat the attribute value as if it
were an element, and using the wildcard and name() functions. You are
overcomplicating things: all you need to do is sort by the column element
whose name attribute value (a string) equates to the parameter (another
string); this is a simple comparison. Just try

<xsl:sort select="column[(_at_)name=$sortByColumn]"/>

Hope that helps,

Stuart

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



<Prev in Thread] Current Thread [Next in Thread>