Questions tagged [xslt-2.0]

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

XSL Transformations version 2.0, the successor to XSLT 1.0. It introduces the following features:

  • xsl:function: user defined functions that can be invoked from within XPath expressions

  • XPath extension mechanism: a formal means of invoking methods written in other languages from within an XSLT expression

  • unparsed-text-available(): checking a URL to insure that it returns text content

  • unparsed-text(): loading non-XML content into an XSLT transformation

  • Sequences: collections of atomic data types or XML objects

  • Date/Time API: functions to manipulate date formats

  • Numeric iterations: expressions that facilitate loops without recursion

  • xsl:analyze-string: text processing of a string based on a regular expression

  • xsl:next-match: allows multiple template rules to be applied to the same source node

  • xsl:result-document: send output to a file or web service

  • xsl:for-each-group: allows nodes to be organized and referenced as a group

  • Inline control keywords: XQuery extensions for iterating and conditional statements in XPath

  • xsl:character-map: map entities to some output form, to replace disable-output-escaping

  • tunnel attribute: allows pass-through of a parameter to a nested template which depends on it

There are several standalone XSLT 2.0 processors, including:

Online Training Courses

Books available online

See also:

  • Saxon CE is an implementation of XSLT 2.0 that runs in any modern browser; it includes extensions that provide declarative handling of user interaction events.

News: As of June 8th 2017, XSLT 3.0 is a Recommendation of the W3C Consortium and therefore the latest version of XSLT.


4654 questions
9
votes
1 answer

XSLT function returns different results [Saxon-EE vs Saxon-HE/PE]

I am currently working on a pure XSL-Transformation with Saxon-Processor in various versions. Below is my short stylesheet, simplified for the needs of my question:
uL1
  • 2,117
  • 2
  • 17
  • 28
9
votes
1 answer

Two phase processing: Do not output empty tags from phase-1 XSLT 2.0 processing

I have some complex XSLT 2.0 transformations. I'm trying to find out if there is general purpose way to ensure that no empty tags are output. So... conceptually, a final stage of processing that recursively removes all empty tags. I understand this…
mentics
  • 6,852
  • 5
  • 39
  • 93
9
votes
4 answers

XSLT: Finding last occurence in a string

Given a form number like: ABC_12345_Q-10 I want to end up with: ABC12345 So I need to find the position of the second underscore Note that there is no standard pattern or length to any of the "sections" between the underscores (so I cannot use…
johkar
  • 435
  • 3
  • 8
  • 12
9
votes
1 answer

XSLT User Defined Function

I am new to XSLT 2.0. I am intrigued by User Defined functions (
Paulb
  • 1,471
  • 2
  • 16
  • 39
9
votes
5 answers

What XSLT 2.0 tools exist?

I'm trying to wrap my head around XML and XSLT stuff, and in my research I stumbled upon different XSLT processors. Xalan was the first one, and it seems to work pretty fine and is free, except that I need/want to use features in the 2.0 specs,…
Olivier Tremblay
  • 1,441
  • 2
  • 20
  • 37
8
votes
3 answers

XSLT split result in groups of 3

An web-application is providing me an XML-feed, which I can't change. What I want to do is split this XML-feed into several unordered lists. I'm trying to do this with the XSLT below.
Rob
  • 6,731
  • 12
  • 52
  • 90
8
votes
3 answers

How to include ancestor branch of a node selected via xpath parameter in output of XSLT

After trying for over 8 hours I am hoping someone can help me with this: Given the following (simplified) XML for a book:
Brunsaim
  • 83
  • 5
8
votes
3 answers

Finding the difference between 2 dates in xslt

Is there a less then kludgey way of finding the difference in days between 2 dates in xslt? If so can you point me in the right direction. I am receiving dates in the format of mm/dd/yyyy.
Mike T
  • 3,696
  • 4
  • 21
  • 21
8
votes
2 answers

Setting a value in a variable on if conditions using XSL

I have a basic condition that checks if a variable is empty and if it is set the variable to a specific value like so.
BaconJuice
  • 3,739
  • 13
  • 56
  • 88
8
votes
1 answer

How to apply-templates to all templates except a spefic one

In the code bellow I'm applying all the templates to the element chapter (in the end of the code) but I would like to know how it is possible to apply all the templates to this element except a spefic one. In this case it's the element title because…
Zombie
  • 321
  • 3
  • 6
  • 16
8
votes
2 answers

Create sequence number in xslt

Input XML:
Paragraph 1 Paragraph 2 Paragraph 3
Paragraph 4 Paragraph 5 Paragraph 6
Required output:
VSe
  • 919
  • 2
  • 13
  • 29
8
votes
2 answers

XSL Analyze-String -> Matching-Substring into multiple variables

I was wondering if it is possible to use analyze-string and set multiple groups within the RegEx and then store all of the matching groups in variables to use later on. like so:
TheStoneFox
  • 3,007
  • 3
  • 31
  • 47
7
votes
1 answer

How to convert text to date, then get year value?

Need to convert a text value `2012-03-19' into a date type, then extract the year component. I'm using Saxon 2.0, but it's…
raffian
  • 31,267
  • 26
  • 103
  • 174
7
votes
1 answer

analyze-string does not match when regex is a variable

The Code Below works as expected and when Internet is present in the text it gets matched. (.*)(Internet)(.*)
7
votes
5 answers

How to pass a XML document to XSL file using Javax.xml.transformer API?

I am using javax.xml.transform API to do XSL transformation . The API only allows one XML document as an input to apply transformation as below . DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); StringWriter stringWriter =…
Saurabh Chaturvedi
  • 2,028
  • 2
  • 18
  • 39