Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Saxon.XSLT

Runs a XML stylesheet transformation.

Component Version macOS Windows Linux Server iOS SDK
Saxon 15.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ❌ No
MBS( "Saxon.XSLT"; XML; StyleSheet )   More

Parameters

Parameter Description Example
XML The XML to work on.
Can be empty if no input is needed.
StyleSheet The stylesheet to apply.

Result

Returns XML or error.

Description

Runs a XML stylesheet transformation.

Set the current working directory with Saxon.SetCWD function, so the function can find relative files.
The output BaseURI can be set with Saxon.SetBaseURI function.

XSLT (Transformation Processing) includes:
  • XSLT 3.0 Basic Processor: Provides all mandatory features from the XSLT 3.0 specification (including try/ catch, iterate, accumulators, maps, named modes, content value templates, and extended patterns, as well as features retained from XSLT 2.0).
  • XSLT 3.0 Serialization: Provides the serialization feature: specifically, the ability to convert the result trees produced as output of an XSLT transformation to lexical XML, or other formats including HTML, JSON, and plain text, under the control of serialization parameters defined in the stylesheet or via an external API.
  • XSLT 3.0 Compatibility: Provides XSLT 1.0 compatibility mode as defined in the XSLT 3.0 specification. If a stylesheet specifies version="1.0", this causes certain constructs to behave in a way that retains the XSLT 1.0 behavior.
  • XSLT 3.0 Dynamic Evaluation: Provides use of the XSLT 3.0 instruction xsl:evaluate, which allows dynamic evaluation of XPath expressions.
  • XSLT 3.0 XPath 3.1 Feature: Provides full use of XPath 3.1 features, including XPath 3.1 functions, and maps and arrays.
Note: Saxon supports XPath 3.1 unconditionally in XSLT 3.0 stylesheets, it does not offer a processing mode in which XPath is restricted to version 3.0.
  • XSLT 3.0 Higher-Order Functions: Provides higher-order functions: specifically, the ability to use functions as values, including dynamic function calls, inline functions, partial function application, and the standard higher-order functions defined in the XPath 3.1 function library.

Examples

Run a XSLT:

Set Variable [ $r ; Value: MBS( "Saxon.XSLT"; Saxon XSLT::XML; Saxon XSLT::XSLT ) ]
Set Field [ Saxon XSLT::Result ; $r ]
#
Set Variable [ $Messages ; Value: MBS( "Saxon.XslMessages") ]
Set Field [ Saxon XSLT::XSL Messages ; $Messages ]

Try it in a let statement:

Let([
xml = "<test><a>1234</a><a>1236</a><a>1239</a></test>";
xslt = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"2.0\">
    <xsl:output method=\"xml\" version=\"1.0\" encoding=\"UTF-8\" indent=\"yes\"/>
    <xsl:template match=\"/test\">
        <result>
            <xsl:value-of select=\"a[1]\"/>
        </result>
    </xsl:template>
</xsl:stylesheet>";
r = MBS( "Saxon.XSLT"; Saxon XSLT::XML; Saxon XSLT::XSLT )

]; r)

Example result:
<?xml version="1.0" encoding="UTF-8"?>
<result>1234</result>

See also

Example Databases

Blog Entries

This function checks for a license.

Created 23th December 2024, last changed 7th January 2025


Saxon.XQuery - Saxon.XslMessages