xsl-list
[Top] [All Lists]

RE: [xsl] Is it possible to create xsl:sort from input parameters using XSLT 2.0 (Saxon)?

2006-07-31 09:53:19
<xsl:param name="sortField"/>

And into this param i pass the XML:

<SortFields>
      <SortField>
              <Sort>lendername</Sort>
              <Order>ascending</Order>
              <DataType>text</DataType>
              <CaseOrder>lowercasefirst</CaseOrder>
      </SortField>
</SortFields>


rather than use 12 parameters (four for each <xsl:sort/>), I 
had hoped that using this XML I would be able to read the 
values out like so:

      <xsl:sort select="$sortField/SortField[1]/Sort"
order="{$sortField/SortField[1]/Order}"/> 

You want $sortField/SortFields/SortField[1]/Order


As far as I can tell the order attribute should read 
"acsending" out of the XML but I've no real way of finding 
out what it is reading.

Take a look at the trace() function, or simply do <xsl:copy-of
select="$sortField"/>.

Better still, write a little schema for this XML document and make your
stylesheet schema-aware, and then the error will be reported to you at
compile time.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--