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
3
votes
4 answers

How to group elements by content (XSLT 2.0)?

-- Modified question -- Thanks already for all who provided potential solutions, but these are in line whith what I tried already, so I assume I should have been more clear. I extended the XML a bit to make the problem more transparent. The XML is…
Wokoman
  • 1,089
  • 2
  • 13
  • 30
3
votes
2 answers

How to preserve xml element's data position with xslt

We are transforming some like following xml: NY Fight for your mind Electric Ladyland
dev3786
  • 31
  • 3
3
votes
1 answer

Inline output document selection using result document in XSLT 2.0

Greetings, I'm looking for a method to do in-line result (output) document selecting in XSLT. I know of the method where one creates an xsl:result-document node to have one transformation apply to multiple documents. Usually this method uses several…
Jon W
  • 15,480
  • 6
  • 37
  • 47
3
votes
3 answers

How to read a txt file from disk and inline the content using XSTL?

I have an xslt and I need to read a file from disk. The file is a simple text file which I would like to read the full content and inline it in my output html/pdf file. Is this possible?
code-gijoe
  • 6,949
  • 14
  • 67
  • 103
3
votes
3 answers

Name of the XSLT-File (not the input XML)

These are the first two lines im my XSLT: Both variables contain the same content, the URI of the processed XML file. How do I get…
Volker
  • 33
  • 4
3
votes
2 answers

Namespaces in XSLT

I'm learning how to do custom functions in XSLT. Every example I find seems to declare a custom namespace, e.g. What I don't…
Mitya
  • 31
  • 2
3
votes
1 answer

xslt replacing empty array with dummy

I have a JSON request like { "aaaa": [] } First I need to check aaaa exist in my request payload, if exists like as above, I need to add a jsonObject with dummy attributes and values like: { "aaaa": [ { "@c": "test" "a":…
karacaoglanb
  • 310
  • 4
  • 17
3
votes
0 answers

does opendatakit provide convertion of html from Xfrom

I found this link from open data kit- https://opendatakit.org/xlsform/. This will take .xls sheet as input which is a representation of html forms which I prepared using this http://xlsform.org/en/. This opendatakit gives me an .XML file. I can…
3
votes
1 answer

How to filter state abbreviations from strings

I have XML where the /forms/form/@number can be in almost any format (any combination of letters, numbers and single spaces). Occasionally there will be @number values which are the same form...but are state specific. When this happens the last 3…
johkar
  • 311
  • 1
  • 3
  • 13
3
votes
2 answers

encode-for-uri and absolute Windows paths

I've got an XML file that contains sections that start with a filename: Each section must be saved to an individual file. This is my XSLT:
Hobbes
  • 1,964
  • 3
  • 18
  • 35
3
votes
1 answer

optimize recursion in XSLT

I have the following XML. It contains books and references. Some references trace back to Book 1, e.g. Book 4 refers to Book 3 which refers to Book 1. Book…
friedemann_bach
  • 1,418
  • 14
  • 29
3
votes
1 answer

XSLT: node()? vs node()*

I've been working through some legacy code in XSLT in order to replace it with something in a more widely used language, and I've hit something about which I can't find a reference. What's the difference between
David Kaufman
  • 989
  • 1
  • 7
  • 20
3
votes
1 answer

xslt function format-dateTime not working, whilst transforming into PDF

I am very new with XSLT and using stylesheets, so maybe I am missing something obvious but I am calling the format-dateTime function in my xsl like below
user6248190
  • 1,233
  • 2
  • 16
  • 31
3
votes
2 answers

Not possible to use template parameter in the match XPath expression in XSLT 2.0?

According to this SO question it should be possible to use parameters in the XPath expression for match. However it does not seem to work if xsl:param of a xsl:template is to be used in the same template. My XML file looks as follows
Jagger
  • 10,350
  • 9
  • 51
  • 93
3
votes
2 answers

Validate IBAN using XSLT 2.0?

is it possible to write an XSLT function which can do the basic IBAN Mod-97 check? From Wikipedia: 1. Move the four initial characters to the end of the string. 2. Replace each letter in the string with two digits, thereby expanding the string,…
oneone
  • 31
  • 2