xsl-list
[Top] [All Lists]

Re: dynamic sort order

2003-07-30 11:23:57
Nathan Shaw wrote:

I am trying to allow an end user to specify the sort
order of a result set returned from an LDAP query. I
am storing their sort request inside of the XML sent
into the LDAP server and plucking it off in my XSLT to
sort as they desired. However, I am running into a
challenge with my approach using a named template, as
you cannot call a named template inside of
xsl:apply-templates.

Your approach is somewhat ... unorthodox. Why don't you let
the LDAP server sort and filter? A few more details about
your XML and the whole problem wouldn't have hurt either.
I'll fill in any blanks, which may or may not have something
to do with your question.

Anyway, assuming your XML is more complete as
 <whatever>
   <supplementaryData> ... </supplementaryData>
   <searchResults>
     <searchResult>
       <employer>foo</employer>
       ...
     </searchResult>
   </searchResults>
 </whatever>

then try
 <xsl:template match="whatever">
   <xsl:apply-templates select="searchResults/searchResult>
     <xsl:sort
  select="*[name()=current()/supplementaryData/sort/sortField[1]]"/>
     <xsl:sort
  select="*[name()=current()/supplementaryData/sort/sortField[2]]"/>
  </xsl:apply-templates>
 </xsl:template>

Feel free to post your problem again with more details if this
doesn't match it.

J.Pietschmann


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



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