Not as difficult as I thought ...
Hi again everyone,
With my trials and tribulations trying to get evaluate to work (msxsl), I felt a bit stumped and confused by recommendations to include external code: Here I assumed that I would have to declare libraries and supply extra (header) files. It was all a bit daunting.
But in the end it wasn't so difficult and it all ran with our old installation of MSXSL (albeit only on our internal IE browser).
Here is a link showing how it's done:
http://xmleverywhere.com/tips/xslt.htm
Basically you need two components ...
1. some extra declarations in the header of your XSLT:
<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">
2. the code:
<msxsl:script implements-prefix="dyn" language="jscript">
function evaluate(context, expression)
{
return context.nextNode().selectNodes(expression);
}
</msxsl:script>
(NB: This comes directly after the header and is specific to MSXSL)
Then to test I declared a variable thus ...
<xsl:variable name="testpath" select="'/dataroot/ref_dateset[1]/@PERTEXT'"/>
... with any node declaration as the value.
And then went on to call up the code thus ...
<xsl:value-of select="dyn:evaluate(., $testpath)"/>
This returned the contents of the node ...
dataroot/ref_dateset[1]/@PERTEXT
Yippeee: I was very pleased as this now means that I can include a whole bunch of stuff in various 'when' clauses which would not have run otherwise.
I wish all the best to anyone else who wishes to try this and many thanks to Michael for prompting me to go along this path.
Regards and thanks,
Alan Searle.