Project

Profile

Help

Syntax for calling Saxon Extension Fuctions?

Added by Anonymous about 18 years ago

Legacy ID: #3988469 Legacy Poster: flyingzumwalt (pollen3d)

I'm confused about the syntax for calling a Saxon extension function from an XSL template. I want to call saxon:base64Binary-to-string() Based on the docs at http://www.saxonica.com/documentation/extensions/functions/base64binarytostring.html I expect that I would call the function like this: <xsl:copy-of select="saxon:base64Binary-to-string(xs:base64Binary('RGFzc2VsIA=='), 'UTF8')" /> Or like this: <xsl:param name="encodedXML" select="doc('input:instance')//XML"/> <xsl:value-of select="saxon:base64Binary-to-string(xs:base64Binary($encodedXML), 'UTF8')" /> But both of these cause errors in the compilation. To be exact, the docs say to enclose the function's parameters in double quotes (ie. saxon:base64Binary-to-string(xs:base64Binary("RGFzc2VsIA=="), "UTF8")), but what about the fact that the function call is itself enclosed in double quotes? _MZ


Replies (4)

Please register to reply

RE: Syntax for calling Saxon Extension Fuctio - Added by Anonymous about 18 years ago

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

Both your examples look fine. If you get errors in the compilation, it would be helpful to tell us what those errors are, then we might be able to explain to you what they mean. The following stylesheet compiles and runs successfully: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:saxon="http://saxon.sf.net/"> <xsl:output method="xml" indent="yes" encoding="UTF-8"/> <xsl:template match="/"> <xsl:copy-of select="saxon:base64Binary-to-string(xs:base64Binary('RGFzc2VsIA=='), 'UTF8')" /> </xsl:template> </xsl:stylesheet> As for single and double quotes, just follow normal XML/XSLT rules. If the attribute is in double quotes, string literals have to be in single quotes.

RE: Syntax for calling Saxon Extension Fuctio - Added by Anonymous about 18 years ago

Legacy ID: #3988513 Legacy Poster: flyingzumwalt (pollen3d)

Thanks mh. I'm calling Saxon from Orbeon Presentation Server, which sort of hides any of Saxon's error messages. I assumed that I had the syntax wrong, but it must be something wrong in OPS. I'll hit their list for tips. Cheers, MZ

RE: Syntax for calling Saxon Extension Fuctio - Added by Anonymous about 18 years ago

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

I'm pretty sure OPS writes the error messages to a log file somewhere - you just have to find it. It can be useful to develop the code outside OPS, though, and only integrate it once it's in a reasonably working state.

RE: Syntax for calling Saxon Extension Fuctio - Added by Anonymous about 18 years ago

Legacy ID: #3988545 Legacy Poster: flyingzumwalt (pollen3d)

Thanks again mh. OPS was calling Saxon with extension functions disbled. Easily fixed. Now I know to test code with a standalone copy of Saxon when I'm trying new things. Sory to bother you. _MZ

    (1-4/4)

    Please register to reply