xsl-list
[Top] [All Lists]

dynamic sort order

2003-07-30 06:55:49
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.

XML:

<supplementaryData>
    <sort>
      <sortField>employer</sortField>
      <sortField>lastName</sortField>
      <sortPage>search.cfm</sortPage>
    </sort>
    <display>
        <displayField>name</displayField>
        <displayField>code</displayField>
        <displayField>employer</displayField>
        <displayField>room</displayField>
        <displayField>phone</displayField>
        <displayField>email</displayField>
    </display>
  </supplementaryData>


XSLT:

<xsl:apply-templates select="searchResult">
  <!-- set the sort -->
  <!-- cannot do this here!!! How to do it??
  <xsl:call-template name="sort" /> -->
</xsl:apply-templates>

<!-- sort -->
<xsl:template name="sort">
  <xsl:for-each
select="/searchResults/supplementaryData/sort/sortField">
    <xsl:sort select="normalize-space(.)"/>
  </xsl:for-each>
</xsl:template>

Any ideas on how I can get around this hiccup?

--Nate


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



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