xsl-list
[Top] [All Lists]

Re: XSL/XPath Dynamic sort key

2003-07-11 06:49:36
And my final line of code supports up to three dynamic sub levels with the final reference being an element or attribute.

<xsl:sort select="*[name()=$sort_select_lvl_3]/*[name()=$sort_select_lvl_2]/*[name()=$sort_select_lvl_1]/@*[name()=$sort_select]|*[name()=$sort_select_lvl_3]/*[name()=$sort_select_lvl_2]/*[name()=$sort_select_lvl_1]/*[name()=$sort_select]|*[name()=$sort_select_lvl_2]/*[name()=$sort_select_lvl_1]/@*[name()=$sort_select]|*[name()=$sort_select_lvl_2]/*[name()=$sort_select_lvl_1]/*[name()=$sort_select]|*[name()=$sort_select_lvl_1]/@*[name()=$sort_select]|*[name()=$sort_select_lvl_1]/*[name()=$sort_select]|*[name()=$sort_select]" data-type="{$sort_data_type}" order="{$sort_order}" />

and believe it or not it actually works. I wish there was a better way but I'll just not worry about it. The reason I can't use saxon, even though I would really like to, is I need it web enabed. (I am assuming here that using saxon limits you to the local command line, which I'm sure is completely wrong)

<xsl:sort select="*[name()=$sort_select]|author/*[name()=$sort_select]"
data-type="{$sort_data_type}" order="{$sort_order}" />

and just set the sort_select param to be 'uid' or 'last_name' or whatever
you want. In each case one branch of the | will return nothing, but
that's OK.

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


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



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