Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: dynamic sort

From: "Joe Fawcett" <joefawcett@-------.--->
To: 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)




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent