Questions tagged [xslt-3.0]

Use this tag for questions specific to XSL Transformations version 3.0 and no other version.


News: Since June 8th, 2017, XSLT 3.0 is a W3C Recommendation, implemented by Saxon since the release 9.8 the same week and subsequently by the releases Saxon 9.9 and Saxon 10.8 on the Java and .NET framework platform as well as by the now stable Saxon 11.5 release now available as Saxon Java 11.5 for Java, SaxonC 11.5 for C++/C, Python, PHP and as SaxonCS 11.5 for the .NET Core 6 or 7 platform and finally since 2023 in the latest Saxon 12.0 releases for Java (HE, PE, EE), C/C++, PHP, Python (SaxonC 12.0 HE, PE, EE as well as PyPi packages saxonche, saxoncpe, saxonche). XSLT 3.0 is also largely (except streaming) implemented by the current release of Altova (XMLSpy, Raptor version since 2017 release 3 or any later release).


XSLT 3.0 introduces the following new features via elements, attributes, and expressions:

References

XSLT 3 processors

  • Saxon 9.8, 9.9, 10, 11, 12 by Saxonica, exists in the free, open-source HE edition and the commercial PE and EE editions, for 9.8 all editions are available for Java or .NET framework or C/C++, the current stable releases 10.8 and 11.5 are available for Java and .NET framework; Saxon 11.5 also for as SaxonC 11.5 for C/C++/PHP/Python. The 9.9 release Java has been cross-compiled as Saxon-C 1.2 for C/C++ with bindings to be used as a PHP extension and as a Python 3 module. The latest stable Saxon releases 10 and 11 available for Java and C/C++/Python/PHP as well as via SaxonCS for .NET 5/6/7 make xsl:evaluate and functions expressions and higher-order functions available in all editions. The newest release in 2022 was Saxon 11, the first for .NET Core 5 or .NET 6, using an XSLT 3.0 based transpiler approach to convert the Java code base into C# code to be compiled and built for .NET Core 5. Unfortunately SaxonCS 11 is currently only available as the EE edition. The C/C++/Python/PHP SaxonC 11.5 and the latest Java Saxon 11.5 release have been published in February 2023. The newest release is 12.0 available since January 2023 for Java, .NET 6/7 as SaxonCS, SaxonC for C/C++/PHP/Python as well as on PyPi.org for Python 3.
  • Altova Raptor, Altova XMLSpy (the XSLT 3.0 implementation in Altova products supports the W3C recommendations of XSLT 3.0 and XPath 3.1, except streaming in XSLT 3)
  • Saxon-JS 2 is available for Node.js (npm install saxon-js, npm install xslt3) and the browser
  • Saxon HE 11 Java has also been successfully cross-compiled with the latest IKVM to .NET 6 to be usable from .NET 6 or 7 code

Online Editors

XSLT 3.0 support in editors and IDEs

Tuturials


Online Training

"What's New in XSLT 3.0: Part 1" -- A Pluralsight video-course (5.5h), by Dimitre Novatchev

"The Evolution of XPath: What’s New in XPath 3.0" -- A Pluralsight video-course (4.5h), by Dimitre Novatchev


731 questions
3
votes
2 answers

Using conditional includes/static parameters in Saxon/C?

I'm trying to use XSLT conditional includes/static parameters with Saxon/C HE, but I'm getting the following error: Error Parameter $some_param cannot be supplied dynamically because it is declared as static To reproduce, I've used an example…
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
3
votes
2 answers

How can I implement a user-defined function with a name in the xpath expression?

I am using XSLT. I know the Inline Function Expressions, Is there some way to declare a named function in xpath expression? because I need the function name to implement a recursive call.
cmf41013
  • 107
  • 1
  • 9
3
votes
3 answers

Using XSLT to transform XML to JSON

I would like to use XSLT to transform some XML into JSON. The XML looks like the following: My Company 1 901
Henry H
  • 43
  • 1
  • 4
3
votes
1 answer

XML serialization in JSON without excessive escaping

How to avoid solidus and double quote escaping of XML in JSON? Given that solidus characters (aka forward slash, /) may, but need not, be escaped in JSON, and that XML attributes may use ' rather than " to avoid escaping in JSON string…
kjhughes
  • 106,133
  • 27
  • 181
  • 240
3
votes
1 answer

xslt: whats the easiest way to do a negated selection?

Basically what I would like is something like this that finds all nodes where the ID cannot be lookup'ed up ('broken links') : But this is not working as…
darune
  • 10,480
  • 2
  • 24
  • 62
3
votes
1 answer

XML - XSLT - document() function inside count() function

I asked a similar question on another post but I decided to make this new one since this is a different problem. I am using two XML input files using the document() function to access one of them (the external file). I am trying to use the…
fobisthename
  • 165
  • 1
  • 10
3
votes
1 answer

How to stop xml-to-json() function of xslt3.0 to convert number to exponent notation

I am transforming a xml into json using xml-to-json() function of xslt 3.0 using Saxon 9.8 HE. The problem I am getting is that my Number value is getting converted into exponent (scientific notation). I want output same what i pass in input…
VSS
  • 196
  • 1
  • 8
3
votes
1 answer

xslt 3.0 json-to-xml and xml-to-json conversion

Currently I need to convert json to xml and xml to json vice versa using XSLT 3.0 & Saxon-HE. Below is my json abc.xml file { "cars" : [ {"doors" : "4","price" : "6L"}, …
Pradeep Singh
  • 1,094
  • 1
  • 9
  • 24
3
votes
0 answers

Alternative to XSLT to transform json in Node.js

I used to use XML / XSLT to transform xml data to various formats and make the result conform to certain patterns using XSD. I found it to be very powerful. We now deal mainly with json data - and I see that there is an XSLT 3.0 version that…
Martin Thompson
  • 3,415
  • 10
  • 38
  • 62
3
votes
2 answers

Add element between two other elements via XSLT?

I have the following input XML: some string aaa some string bbb some string ddd Using XSLT I want to the following output: some string aaa some string…
3
votes
1 answer

XSLT 3.0 Streaming with Grouping and Sum/Accumulator

I'm trying to figure out how to use XSLT Streaming (to reduce memory usage) in a scenario that requires grouping (with an arbitrary number of groups) and summing the group. So far I haven't been able to find any examples. Here's an example…
RyanB
  • 757
  • 4
  • 11
3
votes
2 answers

xsl:sort inside for-each-group()

For some reason xsl:sort inside a for-each-group is throwing an exception since upgrading to Saxon 9.7.0.1 XML- …
Vinit
  • 1,815
  • 17
  • 38
3
votes
2 answers

disable-output-escaping="yes" fails in try/catch

Probably a bug in Saxon but just wanted to clarify- Result -
test
Now try-
Vinit
  • 1,815
  • 17
  • 38
3
votes
2 answers

Use case for XSL Streaming on a small document other than early exit?

I'm investigating use cases for using streaming in XSL. I know of two clear cases: A. You need to transform a very large document, the entirety of which cannot be held in memory. B. You only need a small part of the document, and often that "small…
David R
  • 994
  • 1
  • 11
  • 27
3
votes
3 answers

XSL Remove all preceding siblings based on Element values

Hi I require help parsing the following XML. abc 1234 bcd 2345
user1540142
  • 185
  • 2
  • 15
1
2
3
48 49
woot1woot2
woot1woot2