Questions tagged [saxon]

Saxon is an implementation of XSLT, XQuery, XPath, and XSD. In supports the latest W3C standards including XSLT 3.0, XQuery 3.1, XPath 3.1, and XSD 1.1. There are versions for Java, .NET, and C, in both open source and commercial editions. The latest addition to the product set is Saxon-JS, an XSLT runtime which will run in most browsers.

Saxon is a processor for the W3C languages XSLT, XPath, XQuery and XSD (XML Schema). It was originally created by Michael Kay and is now developed and maintained by Saxonica. There are open-source and commercial versions. Standards supported include XSLT 2.0/3.0, XPath 2.0/3.0/3.1, XQuery 1.0/3.0/3.1, XSD 1.0/1.1, and XQuery Update 1.0. (XSD based validation and XQuery Update as well as optional XSLT 3 features like streaming require a commercial version of the product, like the EE Enterprise edition for streaming in XSLT 3.0). The latest releases 11.6 and 12.3 with the commercial PE and EE editions also supports some experimental XPath 4, XSLT 4 and XQuery 4 extensions.

The product is developed in Java and runs on all standard Java platforms. In addition it has been cross-compiled to .NET, and to a native library with APIs for C/C++ as well as PHP and, in the Saxon/C 1.2 release and the recent SaxonC 11.6 release, a Cython based Python module implementation saxonc (https://www.saxonica.com/saxon-c/doc/html/saxonc.html), as well as with the new SaxonC 12 release directly as a Python wheel on PyPi: https://pypi.org/project/saxonche/. The latest release in the Saxon family is Saxon 12.3, developed on Java and transpiled to C# as SaxonCS 12.3 EE, a pure C# implementation of XSLT 3, XPath 3.1 and XQuery 3.1 for .NET 6, integrating it with new code to interface with the .NET 6 platform then compiled and built for .NET 6 using dotnet.

The Saxon-CE version was compiled to Javascript using GWT and runs in any browser. Saxon-CE is now obsolete; its replacement is Saxon-JS, which in its 1.x releases was only a native Javascript XSLT runtime, relying on the stylesheet first being prepared for execution using Saxon Enterprise Edition but since its 2.x releases supports XSLT 3.0 and XPath 3.1 both client-side in the browser as well as with Node.js, not requiring Saxon Enterprise Edition anymore to precompile an XSLT file to an SEF file but being able to do that on the fly calling the fn:transform XPath 3.1 function or in a pre-processing step using xslt3 on Node.js.

Please use this tag only if your question directly relates to the Saxon processor. If you enquire about XSLT, XQuery, XPath, or XSD in general (i.e. if your question is independent of a specific implementation), use tags XSLT, XQuery, XPath or XSD respectively, with a version number where appropriate.

Saxonica staff monitor this forum, but this is not an official way of requesting product support, and many excellent answers (and a few bad ones) come from users who have no connection with Saxonica. The fact that an answer is ticked means that the original poster found it helpful, it does not mean that the answer is endorsed by Saxonica. If you want to raise a support issue with Saxonica, use http://saxonica.plan.io/

External links:

1825 questions
7
votes
2 answers

Load xml and xslt from embedded resource in Saxon 9.4he

I am using Saxon 9.4 home edition (Saxon-HE 9.4 .NET) to get support for XSLT 2.0 and XPath 2.0, and XQuery 1.0 in .NET. My code crashes when I load files without an URI. Is it possible to load xml/xsl documents without an URI related to the…
soberga
  • 289
  • 7
  • 21
6
votes
2 answers

How to perform schematron validation using Saxon java library command line tool?

Very basic question- I've a xml file and I want to validate it against a schematron file. How do I do it using Saxon command line? As per commandline reference I don't see any option to specify schematron file.
user837208
  • 2,487
  • 7
  • 37
  • 54
6
votes
1 answer

Returning QNames from user-defined function

I am trying to transform a WSDL definition into another format for further processing, but I ran into a problem. I can't seem to return QName-values from a function, without them being turned into a string. I reduced the file to the following, while…
Markus Jarderot
  • 86,735
  • 21
  • 136
  • 138
6
votes
1 answer

XSLT3 can disable-output-escaping be used in same template as expand-text=yes?

I noticed when trying to use disable-output escaping in XSLT3 in Saxon that it would not work if expand-text was set to yes on the stylesheet or even on the given match template The following code (when run on itself) shows the issue (in Saxon…
6
votes
3 answers

How can I format a decimal in xquery?

I'm trying to format decimals in XQuery. The decimals are currency, so the format should be ,###.##. For example: 5573652.23 should be 5,573,652.23 and 352769 should be 352,769 (or 352,769.00 if it's easier/cleaner) Right now I'm using this…
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
6
votes
3 answers

XPTY0004: Required item type of first operand of '>' is numeric; supplied value has item type xs:string

The toComplie string contains all the definitions of the functions like sum, multiply, etc. appended by if ($a > 0) then (iaf:numeric-equal(iaf:numeric-multiply($b, $c), $d)) else (true()) The snippet executing this is : XQueryExecutable…
VijayD
  • 826
  • 1
  • 11
  • 33
6
votes
1 answer

How to use XQuery to output json using Saxon from Java

I'm using XQuery to convert the XML document below to JSON, using Saxon to process the XQuery file. Book1AuthorSurname, Book1AuthorFirstname Book1 Title
Joseph McCarthy
  • 897
  • 2
  • 19
  • 41
6
votes
1 answer

Saxon-HE Integrated Extension Functions | how and where?

Although writing Saxon Integrated Extension Functions are pretty clear to me. I have red: http://www.saxonica.com/html/documentation/extensibility/integratedfunctions/…
Piotr Dajlido
  • 1,982
  • 15
  • 28
6
votes
2 answers

xslt:message in Saxon 9.4 vs Saxon 9.6

I'm trying to throw exception from java code that will include the message from xsl:message tag when using Saxon. Using the following xslt file
tomgi
  • 1,422
  • 11
  • 20
6
votes
2 answers

Should cast of xs:double to xs:decimal be implemented as BigDecimal.valueOf(double) or new BigDecimal(double)?

XQuery, shared with XSLT and XPath 2.0 and later, supports various number data types, two of them are xs:double and xs:decimal. It is possible to cast an xs:double to an xs:decimal, as defined in…
Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
6
votes
1 answer

XSLT 3.0 streaming (Saxon)

I have a big XML file (6 GB) with this kind of tree: E John Smith
steco
  • 1,303
  • 13
  • 16
6
votes
2 answers

XPathFactory not working

I'm trying to use an XPathFactory to evaluate an expression in a Java application. But I'm getting a Saxon-specific error. At one time I used Saxon for some functionality, and to do that I had to set a system…
Anders
  • 12,556
  • 24
  • 104
  • 151
6
votes
1 answer

Insert node into another XML, create new elements (or update existing ones) and reorder resulting document

Well, posting my first question even if I'm assiduously use the site. I've been trying to get a solution for this for the last two days without success. Using some of the answers to similar questions on this site (this, this, this, this and many,…
oswcab
  • 105
  • 6
6
votes
1 answer

Why do I need to use double curly Brackets in my RegEx?

I'm running a little regular expression in one of my xsl-transformations (xsl:analyze-string) and came across this effect that made me rather uncomfortable because I didn't really find any explanation... I was searching for Non-Breaking-Spaces and…
Der Schmu
  • 75
  • 5
6
votes
2 answers

App using saxonHE (9.2.1.1) api to process XSLT (v2.0) against multiple XML files

I have an application that uses the SAXONHE 9.2.1.1 api files to transform XML data to plain text. My form has textboxes for XMLInput_FilePath XSLT_FilePath TextOutput_FilePath On the okButton_Click() event of my form, I have the…
Lorentz
  • 181
  • 1
  • 3
  • 13