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
350
votes
14 answers

Check if a string is null or empty in XSLT

How can I check if a value is null or empty with XSL? For example, if categoryName is empty? I'm using a when choosing construct. For example:
raklos
  • 28,027
  • 60
  • 183
  • 301
113
votes
1 answer

Using copy-of with document() to add SVGs to XHTML output

While processing my XML, I'm trying to copy an SVG file referenced from an href attribute directly into my output HTML with the following line: The copy-namespaces should not be…
jrhooker
  • 1,373
  • 2
  • 11
  • 14
89
votes
3 answers

How to create a boolean value?

I am totally new to XSLT and can't work out where I am going wrong with the following code. variable is true It is always returning true when it is meant to be…
sydlawrence
  • 1,882
  • 2
  • 17
  • 21
81
votes
3 answers

Can one give me the example for "mode" of template in xsl?

In What is the meaning of mode? I searched many many resource, but i couldn't find example for that. So can anybody explain with an example?
Venkat
  • 20,802
  • 26
  • 75
  • 84
78
votes
2 answers

Why does XSLT output all text by default?

Hi I had performed a transformation which drops a tag if it is null. I wanted to check whether my transformation is working fine, so instead of checking it manually, I wrote one more XSLT code which just checks the presence of that particular tag in…
Rookie Programmer Aravind
  • 11,952
  • 23
  • 81
  • 114
75
votes
2 answers

How to remove elements from xml using xslt with stylesheet and xsltproc?

I have a lot of XML files which have something of the form: Which I want to be removed from the file. Using an XSLT stylesheet and the Linux command-line utility xsltproc, how could I do this? By this point in…
Grundlefleck
  • 124,925
  • 25
  • 94
  • 111
67
votes
8 answers

XSLT: How to change an attribute value during ?

I have an XML document, and I want to change the values for one of the attributes. First I copied everything from input to output using:
tomato
  • 5,644
  • 13
  • 43
  • 48
66
votes
3 answers

XSL: Meaning of `match="/"` for `xsl:template`

I am just learning XML and how to use XSL files. In an XSL file I found the following term: xsl:template match="/" What does this stand for? And what could I use instead of the /? Could I write table or any other HTML tag instead of /?
Pat
  • 677
  • 1
  • 6
  • 3
64
votes
2 answers

Upgrading XSLT 1.0 to XSLT 2.0

What is involved in upgrading from XSLT 1.0 to 2.0? 1 - What are the possible reasons for upgrading? 2 - What are the possible reasons for NOT upgrading? 3 - And finally, what are the steps to upgrading? I'm hoping for an executive summary--the…
Witman
  • 1,488
  • 2
  • 15
  • 19
43
votes
2 answers

xsl: how to split strings?

I want to split an address on semicolons (;) into rows separated by
: e.g. if address=123 Elm Street, I want to output 123 Elm Street, but if address=123 Elm Street;PO Box 222, I want to output 123 Elm Street
PO Box 222 and if…
Jason S
  • 184,598
  • 164
  • 608
  • 970
41
votes
4 answers

XSLT xsl:sequence. What is it good for..?

I know the following question is a little bit of beginners but I need your help to understand a basic concept. I would like to say first that I'm a XSLT programmer for 3 years and yet there are some new and quite basics things I've been learning…
user1942476
  • 435
  • 1
  • 5
  • 8
39
votes
3 answers

How to set attribute in XML using XSLT?

For example, I want to add an attribute to this node: So it will look like: Attribute value has to come from XPath. The following will not work :)
VextoR
  • 5,087
  • 22
  • 74
  • 109
31
votes
1 answer

What browsers support XSLT 2.0?

The Safari browser does not support XSLT 2.0 documents. What browsers, if any, support XSLT 2.0?
Pacerier
  • 86,231
  • 106
  • 366
  • 634
25
votes
3 answers

Java XSLT processors supporting XPath 2.0

What are the currently available XSLT processors supporting XPath 2.0 standard?
Lucas Pottersky
  • 1,844
  • 6
  • 22
  • 38
25
votes
4 answers

How to select saxon TransformerFactory in Java

In my web application I need to use Saxon TransformerFactory in order to use XSLT 2.0 but I can't use setProperty method because I don't have this right on the web server and there is a Security Manager. So I have read that it should be possible to…
pAkY88
  • 6,262
  • 11
  • 46
  • 58
1
2 3
99 100