Project

Profile

Help

function-available and XPST0003

Added by Anonymous over 19 years ago

Legacy ID: #3098504 Legacy Poster: Pavel Veller (pveller)

Michael, I faced one intresting issue when migrating from Saxon 7 to Saxon 8. The code below worked just fine <xsl:variable name="var" select="if (function-available('ex:some-expected-extension')) then ex:some-expected-extension($value) else $value"/> The idea is to provide a "core" stylesheet so the application developer could "derrive" from it (just import into a new stylesheet) and customize by declaring a number of "expected" extension functions. With Saxon 8 it failes with XPST0003: ... find a matching 1-argument function named {ex}:some-expected-extension. It's posisble to rewrite the code above with "use-when": <xsl:variable name="var"> <xsl:value-of use-when="function-available('..') = true()" select="ex:..."/> <xsl:value-of use-when="function-available('..') = false()" select="$value"/> </xsl:variable> But I wonder if "use-when" is the only way to keep the customization idea intact and fly with Saxon 8. I would appreciate any advice on the subject. Thanks in advance. Best Regards, Pavel Veller


Replies (2)

RE: function-available and XPST0003 - Added by Anonymous over 19 years ago

Legacy ID: #3098517 Legacy Poster: Michael Kay (mhkay)

Yes, this is an incompatible change to the spec: see list item 6 in section J.1.1 (you should be able to retain the XSLT 1.0 behavior if the stylesheet specifies version="1.0"). This is one of the reasons use-when was introduced. With all the different kinds of functions now available, it was becoming unacceptable that you should get a clean compile if a function name was misspelt. Michael Kay

RE: function-available and XPST0003 - Added by Anonymous over 19 years ago

Legacy ID: #3098530 Legacy Poster: Pavel Veller (pveller)

Thanks! I got you. As long as I don't wanna run in "backward-compatible" mode I'd better rewrite with "use-when". Pavel Veller

    (1-2/2)

    Please register to reply