Thoughts and Notes Ideas that stay with me long enough to get written down

13Jan/060

Can’t use variables in xsl:sort – Ugly

Here's what I'd like to be able to do:
[code lang="xml"]

....
[/code]
That doesn't work, though, because xsl:sort doesn't support using variables for the lang attribute. This bites for multi-language situations where you don't know the language until it's passed in at build time. To make matter worse, if the lang attribute isn't specified, the system language, not the input XML file's xml:lang attribute, is used. On top of that, you can't use a conditional, since the xsl:sort has to be immediately after the xsl:for-each!
So, if I'm on an American English computer, I can't make my Japanese index sort using xsl:sort unless I manually change the lang attribute before running the stylesheet.
Ugly.