3
votes

I've been trying to implement dynamic evaluation of an expression using Exslt extension dyn:evaluate($expression) in XSLT1.0, but I'm getting the below error.

BW-XML-100006 Job-261000 Error in [Transform_MCIN_XML/Dyn.process/Transform XML]
The [net.sf.saxon.trans.XPathException] occurred during XSLT transformation:  
net.sf.saxon.trans.XPathException: 
Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate()
caused by: ; SystemID: tibcr://; Line#: 6; Column#: -1
net.sf.saxon.trans.XPathException: 
Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate()

I'm able to do the same using saxon:evaluate($expr) in Saxon-B XSLT 2.0 engine. However I need to do this in XSLT 1.0.

How to resolve this error and implement the same in XSLT 1.0 in Tibco BW?

Any suggestions would be highly appreciated.

Thank you.

Sample XSLT:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
 xmlns:dyn="http://exslt.org/dynamic"
 extension-element-prefixes="dyn">
    <xsl:variable name="expr" select="not(1=1)"/>
  <xsl:template match="/">
   <eval>
     <xsl:value-of select="dyn:evaluate($expr)"/>
   </eval>
  </xsl:template>
</xsl:stylesheet>
1
I don't understand why you want to restrict yourself to using XSLT 1.0 with EXSLT extension as the error message citing net.sf.saxon.trans clearly indicates you use some version of Saxon 8 or 9 that should support XSLT 2.0 and Saxon specific extensions.Martin Honnen
I'm trying to achieve this in xslt 1.0 because the date validation is simple in here(tib:validate-dateTime()). Is there any single line date validation function available in XSLT2.0?Guru
I am not familiar with tibco and its functions. With XSLT/XPath 2.0 to check whether a string can be parsed as an xs:dateTime value you can check foo castable as xs:dateTime. That tries to parse according to the W3C schema xs:dateTime syntax yyyy-mm-ddThh:mm:ss plus optional time zone information, see w3.org/TR/xmlschema-2/#dateTime for details. For other formats you would need to write a regular expression and/or extract components and check them respectively try to construct a dateTime.Martin Honnen

1 Answers

1
votes

Use tib:evaluate instead of dyn:evaluate.

Depending on what else your BW process contains, you may need to add the namespace below to the process in order to use the tib:evaluate() function:

namespace=http://www.tibco.com/bw/xslt/custom-functions
prefix=tib

To do that you would select the process, click the "namespace registry" button, and add the namespace above.