Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - dynamic sort >Thread Next - Re: dynamic sort Re: dynamic sortTo: NULL Date: 9/6/2004 9:06:00 AM "Michael Frost" <frostbox@h...> wrote in message
news:341571de.0409051954.397b5f90@p......
> How can I pass different expressions as a variable to xsl:sort, like:
>
> expression 1 : *[name()='myval']
> expression 2 : tree1/tree2[somenode='someval']/tree3/someothernode
>
> making this sorting possible:
>
> ..
> <xsl:variable name="v_sort" select=" -->expression<-- "/>
>
> <xsl:for-each select="mynodeset">
> <xsl:sort select="$v_sort"/>
> ..
> </xsl:for-each>
>
>
> Both expressions works fine when inserted directly into the sort!
> I know that xsl variables cannot be passed directly to xsl:sort, but
> is there some other solution or workaround to this problem?
Workaround:
Modify the sort-select attribute before invoking the stylesheet using DOM
methods.
pseudo-code
load stylesheet
add namespace identifier for xsl
select sort element (xsl:sort[1] for example)
set select attribute sort.setAttribute("select", ...)
invoke transform
--
Joe (MVP - xml)
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
