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

How to ignore xml namespaces in XSL?

I have a xml which contains empty xmlns:tag0='' is there a way I can ignore namespaces alltogether or add some default value to it? Because it is stopping my xml to open with xsl transformations. It says Reference to undeclared namespace prefix:…
AabinGunz
  • 12,109
  • 54
  • 146
  • 218
4
votes
2 answers

xslt nodesets vs. sequences

I want to know how nodesets and sequences differ. Why are sequences considered better in xslt 2.0? Can someone please give me an example of a nodeset(with a select attribute) and how that can be converted to a sequence?
harsh
  • 2,399
  • 9
  • 29
  • 47
4
votes
3 answers

Create XSL from XSL

I am trying to dynamically generate an XSLT document from an XSLT stylesheet. In principle this works, of course, but I do not get the namespaces working. I want to have the generated XSLT elements to be prefixed with "xsl" prefix:
divB
  • 896
  • 1
  • 11
  • 28
4
votes
4 answers

how to get the most deeply nested element nodes using xpath? (implementation with XMLTWIG)

I need to extract (XSLT, xpath, xquery... Preferably xpath) the most deeply nested element nodes with method (DEST id="RUSSIA" method="delete"/>) and his direct ancestor (SOURCE id="AFRICA" method="modify">). I don't want to get the top nodes with…
laurentngu
  • 357
  • 2
  • 13
4
votes
2 answers

XSLT - Delete Nodes + attributes that match Xpath

I'm trying to find the best (efficient) way of doing this. I have a medium sized XML document. Depending on specific settings certain portions of it need to be filtered out for security reasons. I'll be doing this in XSLT as it's configurable and no…
Ryan Ternier
  • 8,714
  • 4
  • 46
  • 69
4
votes
1 answer

xsl:choose check all xsl:when conditions

Is there any way not to leave after first match but continue check else conditions?
Alexander Zhugastrov
  • 12,678
  • 2
  • 20
  • 22
3
votes
2 answers

XSLT with XPAth 2.0 and Java expressions

I would like to use XPath 2.0, more specifically the distinct-values function. I downloaded the Saxon Home Edition because it can do XPath 2.0 and XSLT 2.0 but now it moans about not being able to invoke java stuff. Cannot find a matching 1-argument…
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
3
votes
1 answer

How to eval an XSL constructed XPath expression

Humm... seems to be the solution... Regards, Christophe I have a variable that contains the name of an attribute to query. How can I wrote such an XPath expression ? Here is an example of…
3
votes
3 answers

What are some useful constructs for using XSLT to produce XSLT?

I have an existing XSLT stylesheet that takes XML and produces nicely formatted XHTML. I want to make an XSL-FO version of this stylesheet to produce PDF via Apache FOP. What I want to know is this: Are there any convenient to use xslt patterns I…
Jay Stevens
  • 5,863
  • 9
  • 44
  • 67
3
votes
2 answers

XSL variable usage

Hi I have one XSL variable Now I need to pass this to JavaScript function. Please help me how to do this... For example…
Varun
  • 426
  • 3
  • 7
  • 18
3
votes
1 answer

How have xsl:function return a string value including html tags

I am attempting to transpose a java function to an xsl:function spec. The function basically places html tags around substrings. I now bump into difficulties: using the java inline code this works perfectly, but I am unable to figure out how to…
Maestro13
  • 3,656
  • 8
  • 42
  • 72
3
votes
2 answers

How do I 'mix and match' entity translation in XSLT2 replace() function?

I'm experimenting with XSLT2, using a stylesheet based on this answer:
user533832
3
votes
1 answer

xslt 2.0 and Ruby on OS X

I am attempting to parse an XML document against an XSLT 2.0 sheet. However, I am being told that the libraries on OSX 10.5.x only support XSLT 1.0 operations. When I look at xsltproc, I get this: hmasing$ xsltproc --version Using libxml 20616,…
user109565
3
votes
3 answers

Finding the lowest common ancestor of an XML node-set

I have a node set constructed using the xsl:key structure in XSLT. I would like to find the lowest common ancestor (LCA) of all of the nodes in this node-set - any ideas? I know about Kaysian intersects and XPath's intersect function, but these…
Tom Hillman
  • 327
  • 1
  • 10
3
votes
4 answers