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
6
votes
2 answers

how to create a xsl:function that returns a boolean

I want to create a xsl:function with a few parameters that can return a boolean, i'm having troubles: SAME!
Bas Hendriks
  • 609
  • 1
  • 7
  • 14
6
votes
3 answers

XSLT 2.0 produces error: "the context item is undefined"

We use Altova Stylevision which produces XSLT 2.0 files. We use Saxon 9 for Java to execute these XSLT files. This has been working well for a few years, alas none of us actually understand XSLT. Now we have the error: Error at…
Adrian Smith
  • 17,236
  • 11
  • 71
  • 93
5
votes
1 answer

XSLT: Remove namespace prefix from elements

I need to remove the namespace prefix from an un-SOAP'd message. This is the message that has had the SOAP envelope removed. As you can see it contains ns1 prefix on the elements:
Tony J
  • 107
  • 1
  • 3
  • 8
5
votes
2 answers

Why does index-of() return multiple values when applied to a sequence of unique nodes?

I'm using xpath2's index-of value to return the index of current() within a sorted sequence of nodes. Using SAXON, the sorted sequence of nodes are unique, yet index-of returns a sequence of two values. This does not happen all the time, just very…
David R
  • 994
  • 1
  • 11
  • 27
5
votes
2 answers

In XSLT can I tokenize on nothing?

I need to convert the string 'abcdef' to its parts, 'a', 'b', 'c', 'd', 'e', 'f'. Stupidly I tried tokenize('abcdef', '') but of course that returns a FORX0003 error (The regular expression in tokenize() must not be one that matches a…
͢bts
  • 695
  • 8
  • 32
5
votes
2 answers

How to wrap text to fit window in XSLT

I am extracting data from XML using XSLT 2.0. The data has long lines and I want to fit them into window size by automatically breaking lines. Is it possible in XSLT?
smandape
  • 1,033
  • 2
  • 14
  • 31
5
votes
1 answer

How to print a document's content to the debug output?

I see that in the XSL there is an instruction that prints some text to the debug output console. SOME MESSAGES How can I print the whole document's content to the console?
Nawa
  • 2,058
  • 8
  • 26
  • 48
5
votes
3 answers

XSLT 2.0 group-adjacent based on attribute value

I am trying to generate XML using XSLT, I want to generate a string when two consecutive nodes has an attribute value as Position="A", I want to add a hyphen(-) in the string, otherwise I want to concatenate node value. I tried using group-adjacent…
5
votes
4 answers

Custom format for

Is it possible to define a custom format for ? I have the case where a standard alpha-based format is desired, but certain characters in the alphabet are forbidden (strange requirement, but it is what the client requires). For example,…
ewh
  • 1,004
  • 9
  • 19
5
votes
1 answer

How to format date in XSLT 2.0

I need to display date like Wednesday, 5th May, 2011 I am trying
jvm
  • 1,662
  • 8
  • 27
  • 46
5
votes
1 answer

What is the best way to join multiple element values into a new string in xslt 2.0

I need to join multiple element values into a new string separated with whitespace, what is the best way to do this? I am using xslt 2.0. Thanks in advance.
5
votes
3 answers

The entity "nbsp" was referenced, but not declared

I have written one XSLT to transform xml to xml. Input XML: The Spanish word for "Spain" is "Espa a" Dagon his Name, Sea Monster OutputXML: The Spanish word for "Spain" is "Espa a" Dagon his Name, Sea Monster XSL…
Umaima
  • 137
  • 1
  • 1
  • 9
5
votes
1 answer

How can I use XSLT 2.0 and XSLT 3.0 in Java?

I am able to use XSLT 1.0 in Java as shown in the folllowing example :- copy.xml Gambardella, Matthew
user6276653
  • 140
  • 1
  • 2
  • 11
5
votes
3 answers

Saxon XSLT 2.0 and RFC 822 date format

What is the right way to format xs:dateTime to RFC 822?
chardex
  • 323
  • 1
  • 5
  • 17
5
votes
0 answers

Converting XHTML table with rowspan and colspan to LaTeX

I have been looking for a suitable solution for conversion of an HTML table to LaTeX. I have found the following questions which is similar to my requirement: XML table to LaTeX Converting XHTML table to LaTeX using XSLT But both of these were not…
Jagath
  • 328
  • 5
  • 19