This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Converting a string to node test
Hi,
> Does Microsoft have an extension function like saxon:evaluate() ?
Not a built-in one, no. However, you can define one of your own using
msxsl:script. The following one just interprets XPaths and is
basically the one posted by Andrew Kimball in January:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dyn="http://exslt.org/dynamic"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
extension-element-prefixes="dyn msxsl">
<msxsl:script implements-prefix="dyn" language="jscript">
function evaluate(context, expression)
{
return context.nextNode().selectNodes(expression);
}
</msxsl:script>
...
</xsl:stylesheet>
You could call it with:
dyn:evaluate(., concat('@', $y))
to get the attribute named the same as the string held in $y on the
context node.
[I've used the EXSLT namespace here, but you should make up your own
unless you submit the function to the EXSLT site at
http://www.exslt.org/.]
I hope that helps,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list