This post was imported from my old Drupal blog. To see the full thing, including comments, it's best to visit the Internet Archive.

David Carlisle’s posted a great tip on getting exsl:node-set() to work in IE:

In the above XSL-List thread I casually suggested that an alternative would be to just always use exslt:node-set in the body of the stylesheet and use the msxsl:script extension to define exslt:node-set for IE. That turned out not to be as easy as I thought as node-set isn’t a valid function name in either of the supported extension languages in msxsl (JScript or VBScript). However Julian Reschke came up with the construct needed, use associative array syntax so you can use [‘node-set’] to define the function.

I’ve been having related problems getting my XSLT unit testing framework to work with XSLT 1.0 stylesheets designed to work with MSXML, and specifically to use the msxsl:node-set() function. The solution there was to provide an implementation of msxsl:node-set() using <xsl:function>:

<xsl:function name="msxsl:node-set" as="document-node()" override="no">
  <xsl:param name="items" as="item()*" />
    <xsl:sequence select="$items" />

Note the override="no" which marks this as an implementation to be used only when the processor doesn’t support it natively. This is an issue with msxsl:node-set() at the moment, but in the general case if you’re writing a user-defined function that mirrors a vendor’s extension function then you ought to use override="no".

What I should do is add XSLT 2.0 implementations of all the EXSLT functions to the unit testing framework too…