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
5
votes
1 answer

Applying templates to elements in a variable/sequence

When I use "apply-templates" and select a variable sequence, does the template act upon the context of the element in the sequence, or does it act upon the context of the element in the document? In the below example, it seems to do either, or none,…
5
votes
1 answer

xsl:character-map to replace special characters

Given an element with a value of: Distrib = SU & Prem &lt;&gt; 0 I need to turn &lt; or &gt; into < or > because a downstream app requires it in this format throughout the entire XML document. …
johkar
  • 435
  • 3
  • 8
  • 12
5
votes
2 answers

Strip leading spaces only

Given element: comments go here How can I strip what may be multiple leading space characters. I cannot use normalize space because I need to retain newlines and such. XSLT 2.0 ok.
johkar
  • 435
  • 3
  • 8
  • 12
5
votes
1 answer

XSLT 2.0 regular expression replace

I have the following XML: a_35345_0_234_345_666_888 I would like to replace the first occurrence of number after "_" with a fixed number 234. So the result should look like: a_234_0_234_345_666_888 I have tried using the following…
M Tracker
  • 75
  • 1
  • 1
  • 5
5
votes
2 answers

How to Increment 1 day in Date using XSLT

I have a scenario in which we need to increment 1 day in existing date. Like In 2015-05-06 I want to increase 1 day and map its value to 2015-05-07. How can I achieve this…
Waqas Ali Razzaq
  • 659
  • 1
  • 5
  • 30
5
votes
4 answers

Difference between != and not ( = )

What is the difference between the not() operator and !=? See this example: 123 true1
Willi Fischer
  • 455
  • 6
  • 21
5
votes
1 answer
5
votes
3 answers

Match attribute on XSLT instead of matching the whole element

I want to write an XSL template that matches attributes instead of nodes, I would think that having something like this: would match any of those 3…
rovinos
  • 222
  • 1
  • 3
  • 7
5
votes
1 answer

Build XML structure from attributes in single node

I have the following XML source: In any order, I need to loop through specific attributes (i.e. only ones which are related to the HTML I'm building:…
Aaron
  • 271
  • 2
  • 11
5
votes
3 answers

List child nodes of element XSLT

So I want to list all the child nodes with name and text of Specs node. Samsung SSD…
Enzero
  • 1,141
  • 2
  • 17
  • 36
5
votes
3 answers

Use a variable for a namespace in an XSL transform

This is probably a duplicate, but I haven't found the answer from any other posts so I will go ahead and ask. Inside an XSL file, I'd like to have variables that are the namespaces that will be output. Something like:
chrismead
  • 2,163
  • 3
  • 24
  • 36
5
votes
3 answers

How to change Apache FOP Xalan XSLT Processor?

I am using Apache FOP 1.1.I want to change current apache Xalan XSLT processor to other for supporting XSLT 2.0. Currently it is not supporting XSLT 2.0. Please help me how to solve this problem. thank you.
Oomph Fortuity
  • 5,710
  • 10
  • 44
  • 89
5
votes
1 answer

How to to get the desired base URI when xsl is run from another file?

When my tests are run with XSpec, there is a glaring problem: the base URI of global variables is set to the xspec parent that's running my XSLT and not the XML input itself. Thus, when my XSL transformation is ran by itself against the XML,…
Vadim Peretokin
  • 2,221
  • 3
  • 29
  • 40
5
votes
2 answers

Mixed Content and String Manipulation Clean Up

I am in the middle of a very painful process of transforming a Word-based document into XML. I have run into the following problem:

This one is taken care of. Some…

Tench
  • 485
  • 3
  • 18
5
votes
3 answers

How to check if an XML node contains text

How can I check if a XML node contains text, or only empty nodes? Example: Let's say we have the following XML:

(Note the whitespace between the p tags) In a different XML, we have the following XML:
Helge
  • 823
  • 5
  • 13
  • 28