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
0 answers

Conversion of Milliseconds into date is not working

I have an Input XML in which I have an time-stamp in long digit. I am trying to convert it into readable date format. I searched on internet and found few solutions. But none of them is working. Please guide me , what am I missing?. I want to…
omer khalid
  • 855
  • 1
  • 12
  • 39
3
votes
1 answer

Adding leading zeroes to record in xslt

We have a number in XML that can go up to 3 digits in a large XML file that has to be converted to fixed length text using xslt for loading into another system. I need to pad this with leading zeros to a length of 3 in the output (which is fixed…
Maash
  • 31
  • 1
  • 5
3
votes
2 answers

Grouping text node and adjacent elements of particular type

Please suggest, how to group the text node and some elements like 'i' or 'b' or 'list' within 'p' element. Ensuring div should not child to p. XML: (with line breaks or whitespaces for display purpose, to run use below 2nd XML)
Rudramuni TP
  • 1,268
  • 2
  • 16
  • 26
3
votes
3 answers

Test if document is well formed before parsing

I need to analyze a few thousand XML documents to see if some of them contains a certain construct. The problem is that some of the documents doesn't contain well formed XML. The basic idea was to use fn:collection() and search inside nodes…
Per T
  • 2,008
  • 17
  • 14
3
votes
1 answer

XSLT - analyze following successive nodes

I have a xml like this, texttext1texttext1texttext texttext12texttext
sanjay
  • 1,020
  • 1
  • 16
  • 38
3
votes
1 answer

XSLT - identify node followed by another node

I have a xml like this,

paraparaparaparapara

paraparaparapara

I need to add a ',' between nodes if couple of placed successively ( followed by another node). so, for…
sanjay
  • 1,020
  • 1
  • 16
  • 38
3
votes
3 answers

Removing a parent element in xml while keeping it's children using xslt

I want to transform the following xml, 4 Lions 9 Lion 3
Ravindra Ranwala
  • 20,744
  • 6
  • 45
  • 63
3
votes
1 answer

Identity transform strange behavior when use with another template

I have seen strange behavious, by strange mean it act as opposite to the conditions as we do in normally. following are the details: XSLT Code
Hikmat
  • 450
  • 4
  • 19
3
votes
1 answer

Axis step child::element cannot be used here: the context item is an atomic value

I am not sure why I receive the following error in my XSLT: Axis step child::element(_SetMax42, xs:anyType) cannot be used here: the context item is an atomic value It seems like using count on the xsl:when condition seems to cause it, but I…
A. Shah
  • 37
  • 6
3
votes
1 answer

Saxon Transformation ERROR- XTDE1450: Unknown extension instruction

I am trying to query MySQL database from XSLT2.0 using SQL query and populate a parameter in my XSLT file. I am using saxon9ee.jar along with saxon9-sql.jar. I found the this link, but it didn't resolve my issue. I am getting below error…
dev
  • 1,343
  • 2
  • 19
  • 40
3
votes
1 answer

xslt concatenate all descendants of a type using a separator

I am using XSL to convert a HTML document to XML. How to concatenate the text in all the descendant nodes of a particular type with a separator?As an example I have a table node and it has several td nodes as descendants, how to combine the text in…
3
votes
3 answers

Correct xslt/xpath syntax for accessing xml nodes retrieved from REST API call

First time posting, so please excuse my naivete. I am currently trying to transform an xml file for the Structured Product Labeling of Avycaz retrieved from the National Library of Medicine's DailyMed website. I want to insert data obtained via REST…
3
votes
1 answer

How to diff two .xml files and store differences in XSLT?

I need this for patching. I can't change the first xml, but I have the possibility to apply .xslt to create patched version from original file. Which commands I should use? Also, which command will create the second .xml from first xml and xslt…
user1709408
  • 528
  • 4
  • 16
3
votes
3 answers

XSLT: can I create a library of functions which are a templates theirselves?

I have several XSLT transformations. They all contain same template, which looks like this (its implementation and functionality do not matter):
MiamiBeach
  • 3,261
  • 6
  • 28
  • 54
3
votes
4 answers

Get text from a grand-child using XPath and contains function

I've the below XML.
<page num="1150"/> <content-style font-style="bold">ORDER 62</content-style> <content-style format="smallcaps">Costs</content-style>
Here i want to…
user3872094
  • 3,269
  • 8
  • 33
  • 71