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

How to use for each group in XSL

im still learning for-each-group what is the best way of grouping something like this using XSL?(by country) i'm trying to use XSL to convert this XML to another XML.
Hash
  • 7,726
  • 9
  • 34
  • 53
14
votes
3 answers

What is the default select of XSLT apply-templates?

The identity template looks like this: Does select more than…
Svish
  • 152,914
  • 173
  • 462
  • 620
13
votes
4 answers

Remove Elements and/or Attributes by Name per XSL Parameters

The following does the job of removing unwanted elements and attributes by name ("removeMe" in this example) from an XML file:
Witman
  • 1,488
  • 2
  • 15
  • 19
13
votes
1 answer

XSLT 2.0 support in emacs nXML mode

I'm editing an XSLT 2.0 document in emacs and get an "attribute value invalid" error on the version number, i.e., If I replace the "2.0" with "1.0" I don't get an…
Marc Stober
  • 10,237
  • 3
  • 26
  • 31
13
votes
3 answers

XSLT: If tag exists, apply template; if not, choose static value

I am new to XSLT in general so please bear with me... With that in mind, what I am trying to do is check for a certain tag in the XML. If it is there I want to apply a template. If not, I want to add it (as a blank value). Basically always…
Issa Fram
  • 2,556
  • 7
  • 33
  • 63
13
votes
2 answers

Evaluate Xpath2.0 in python

I have an XPath expression as shown below. if(replace(//p[1]/text(),'H','h') = 'hello') then //p[1]/text() else if(//p[1]/text() = 'world') then //p[2]/text() else 'notFound' I want to display which 'if ' expression worked. e.g //p[1]/text() if…
Er Bharath Ram
  • 131
  • 1
  • 3
13
votes
1 answer

how to use xslt 2.0 in visual studio 2010

I am using xslt 2.0 for transforming one xml format to another xml format.But Visual Studio 2010 supports only xslt1.0. So, I referred the stackoverflow link and followed the procedure they said.But it did not working for me...…
Saravanan
  • 11,372
  • 43
  • 143
  • 213
12
votes
2 answers

How to parse string to date in xslt 2.0

Is it possible to convert strings like 30042013 (30 April 2013) to a date format? So I can use it later in functions like format-date
VextoR
  • 5,087
  • 22
  • 74
  • 109
11
votes
2 answers

Multiply 2 numbers and then sum

I am having a difficult time trying to do something that seems like it should be really easy to do. I basically want to multiply 2 numbers in a node and then sum the total of those numbers for all the nodes. Here is the XSLT code I have…
Dave
11
votes
3 answers

Convert dateTime to unix epoch in xslt

I have a dateTime variable, and I want to convert it to a decimal value of epoch. How can this be done? I tried using: seconds-from-duration($time, xs:dateTime('1970-01-01T00:00:00')) but it just returns 0. Please advice. Thanks.
Anna
  • 4,099
  • 4
  • 24
  • 26
11
votes
2 answers

XSLT Remove leading and trailing whitespace of all attributes

How can I create an identical XML sheet, but with the leading and trailing whitespaces of each attribute removed? (using XSLT 2.0) Go from this:
user937726
10
votes
3 answers

Conditional variable select in XSLT

I want a variable to have the value of an element if the value is numeric, but if it's not then I want the variable to have the value 0. In other words, is there a simple equivalent of the following in XSLT? var foobar = is_numeric(element value) ?…
Svish
  • 152,914
  • 173
  • 462
  • 620
10
votes
3 answers

xml, html or xhtml in : Which is the better choice?

For historic reasons we have a mixture of and and inside an include-hierarchy of XSL files. Now we want to refactor so all XSL files use the same output method. In…
B.E.
  • 5,080
  • 4
  • 35
  • 43
9
votes
5 answers

Preserving entity references when transforming XML with XSLT?

How can I preserve entity references when transforming XML with XSLT (2.0)? With all of the processors I've tried, the entity gets resolved by default. I can use xsl:character-map to handle the character entities, but what about text entities? For…
Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
9
votes
4 answers

XSL recursive call - xsl:functions vs xsl:template with call template

I have basic query. I have been using xsl:template and use call tempate to make recursive calls to the template. I see xsl:function which also has feasibility to make recursive function calls like recursive template calls and achieve the same. When…
Rachel
  • 763
  • 14
  • 29