Project

Profile

Help

Looking for saxon:evaluate() example code

Added by nirmalya sinha almost 6 years ago

I have a transform.xsl file with will process a input.xml. But there is also an additional config.xml file which will define additional clauses. For e.g. this is the content of the config.xml.

<Location > <DisplayName> <Attribute1>ABC</Attribute1> <Attribute2>XYZ</Attribute2> <action>concat($Attribute1,$Attribute2)</action> </DisplayName> </Location >

So when transform.xsl will encounter the DisplayName variable within the input.xml, then it will form the value with the RESULT of the action expression defined in the config.xml file. transform.xml will call the config.xml just to get the result. (The action can be modified by the end user and hence these are placed outside the xsl file, within the config.xml).

We are using saxon xml processor version 9 and xslt 2.0. So we need to use saxon:evaluate(). I tried to find more examples of saxon:evaluate(), but couldn't find it more. Can anyone show me some examples of how to use it?

Thanks in advance.


Replies (2)

RE: Looking for saxon:evaluate() example code - Added by Michael Kay almost 6 years ago

I suspect you're asking on the wrong forum - Saxon-CE is no longer supported, but I don't think that's what you're using.

In recent releases of Saxon (9.8, 9.9) we implement the XSLT 3.0 xsl:evaluate instruction, and I would encourage you to use that in place of the old saxon:evaluate() -- it's standard, and it's much more comprehensive. The saxon:evaluate() function is still there and is described at http://www.saxonica.com/documentation/index.html#!functions/saxon/evaluate

One difference between xsl:evaluate and saxon:evaluate is that saxon:evaluate expressions can only use the ten variables $p1, $p2, etc, whereas with xsl:evaluate you can have arbitrary variables with names of your own choosing. So for this example you clearly need xsl:evaluate.

If you're having trouble getting something working then it's best to show us your code, explaining what you want to achieve and how your attempt failed. We can then see where you went wrong and explain the problem. Otherwise, you're essentially asking us to write additional documentation for you, without a clear idea of why the existing documentation is inadequate.

RE: Looking for saxon:evaluate() example code - Added by Anonymous about 5 years ago

Actually, I thoroughly concur with creator feeling about this subject and I imagine that it would be truly fascinating to make such exchange with different site visitors.Personally, I absolutely concur with creator assessment about hostgator coupon code 80 off subject and I believe that it would be truly intriguing to make such discourse with different site guests.

    (1-2/2)

    Please register to reply