I have no problems running the following dynamic XPath evaluator form MSXSL:
<msxsl:script implements-prefix="dyn" language="jscript">
evaluate(context, expression)
{
return context.nextNode().selectNodes(expression);
}
</msxsl:script>
However, I need to run the equivalent from dot net as an XSLT extension
object
The following code fails with a {"Index was outside the bounds of the
array." }
class XSLTExtensionObjects
{
public IXMLDOMNodeList evaluate(IXMLDOMNamedNodeMap context, string
expression)
{
return context.nextNode().selectNodes(expression);
}
}
XsltArgumentList xslArg = new XsltArgumentList();
XSLTExtensionObjects obj = new XSLTExtensionObjects();
xslArg.AddExtensionObject("urn:dynCs", obj);
fs = new FileStream(outData,FileMode.Create);
transform.Transform(doc,xslArg,fs,new XmlUrlResolver());
with this code in the XSLT:
<xsl:value-of select="dynCs:evaluate(($LossReport),string(./@from))"/>
(I have no trouble calling simple string based dot net extenstion functions)