XSLT Rekindled

I used to consider myself a bit of an XSLT guru, but it's been a long while since I've done anything with it. This is just a stream of consciousness as I'm working on this issue. If anyone has any thoughts, let me know. Otherwise, I'll update it when I solve it :)

After MSXSL 2.6, Microsoft removed support for the $var/el syntax in XPath. As an alternative (many other parsers offer similar extensions), they offer a node-set function which replaces the previous syntax with a pattern such as msxsl:node-set($var)/el.  I always thought that $var could be an XPath pattern there.

Basically I have some XML that looks like this:

<Root> <Schema> <Property id=&#8220;title&#8220; xpath="&#8220;a&#8220;"></Property> </Schema> <Data> <Node> <Node id=1 name="Something" /> <Node id=2 name="Something else" /> </Node> </Data></Root>

In my XSLT, I'm applying templates on the /Root/Schema/Property. The actual template looks something like this:

<xsl:template match="&#8220;Property&#8220;"> <SELECT id=&#8220;{@id}&#8220;> <xsl:for-each select=&#8220;msxsl:node-set(string(@xpath))&#8220;> <OPTION value=&#8220;{@id}&#8220;> </xsl:for-each> </SELECT></xsl:template>

So... the question is, then, how do you convert an XPath into a node-set, if this doesn't work?

I thought I might be able to hack around my problem using an xsl:key - but besides not really being intended for this, they can also only be a child of xsl:stylesheet. This means I can't have n number of keys for each data item, and I have to declare them upfront. \

I was pretty sure this had worked in the past, so I'm stumped now.

Another thing I find absurd is that you can't pass in a variable to the apply-template's mode attribute or call-template's select attribute. I managed to work around this using because the attribute I'm trying to match is on the node itself - so I can use match templates with a static mode.

If the variable I wanted to use wasn't on the node itself, I don't know that I would have a viable alternative here though.

Consumer Tech