XSLT topics


In this page, I maintain a collection of XSLT topics. Much of the material here is my recollection of questions and answers taken from mailing list threads, in most of whom I've participated. In the process of discussions, I've learnt a lot. I sincerely thank many people on various XSL mailing lists and newsgroups, who ask interesting questions, and which has given me this expertise. I hope, that this small collection of material may be of help to the XSL community.


1.
 
Array implementation  with XSLT

I felt the need to implement array like data structure in XSLT, when I encountered some programming problems which needed to keep data in such form, and process the same. A true array implementation is not possible in XSLT (for e.g. as available in Java or C), because XSLT does not allow to modify variable values. Therefore, this implementation is said to be array like.

The example is tested with Xalan-J 2.6.0:

java org.apache.xalan.xslt.Process -in array.xsl -xsl array.xsl

With XSLT 2.0 this is easier. The XSLT 2.0 version of arrays can be downloaded here.

The 2.0 example is tested with Saxon 8.0:

java  net.sf.saxon.Transform array2.0.xsl array2.0.xsl

The stylesheet for this example can be accessed, here.

2.  Hashtable implementation  with XSLT


I got motivated to implement Hastable like data structure in XSLT, because of its existence in Java. A true hashtable implementation is not possible in XSLT (for e.g. as available in Java), because XSLT does not allow to modify variable values. Therefore, this implementation is said to be hashtable like.

The example is tested with Xalan-J 2.6.0:

java org.apache.xalan.xslt.Process -in hashtable.xsl -xsl hashtable.xsl

The stylesheet for this example can be accessed, here.

3.  Base64  processing with XSLT

Please visit this page, to look at the XSLT stylesheets.

4
. Exploring new date and time related operations available in XSLT 2.0

The file for this example can be downloaded here - XSL.

The example is tested with Saxon 8.0:

java  net.sf.saxon.Transform datetimexslt2.xsl datetimexslt2.xsl

XSLT 2.0 now supporting data typing (based on XML Schema), makes date and time aware operations easy.

5
. XSLT grouping techniques

I have tried to recollect few examples of XSLT grouping problems, I encountered while participating in XSL communities. These can be accessed, here.

Here are some specific XSLT grouping techniques:

6. Number manipulation with XSLT

Numerous problems related to numeric handling in XSLT are discussed at Dave Pawson's web site: http://www.dpawson.co.uk/xsl/sect2/N5758.html.

I am also compiling some number manipulation problems solved using XSLT, here.

7. Merging XML documents

8. Recursion with XSLT

9. Some interesting XSLT problems

10. Interesting facts about XSLT

Many interesting things about XSLT are discussed at Dave Pawson's web site: http://www.dpawson.co.uk/xsl/index.html.

I am also compiling some interesting facts about XSLT, here.

11. Schema aware XSLT

Schema awareness is a new feature introduced in XSLT 2.0. This is quite innovative and a very useful facility. This page discusses some details about Schema awareness features introduced in XSLT 2.0.

12. XSLT extensions

13. Comparing XSLT 1.0 and XSLT 2.0

14. Things XSLT can't do

Of course, many useful XML/text transformations can be performed with XSLT. But there are certain things, which XSLT cannot accommodate. In this section, I maintain a collection of such XSLT limitations. This is not a complete list. More information about this can be found at Dave Pawson's site: http://www.dpawson.co.uk/xsl/sect2/nono.html.

15. Links to interesting discussions, on XSL-List archives

I intend to use this chapter, to directly point to posts in XSL-List archives, which contain interesting discussions about specific XSLT and XPath topics. This allows me, to not repeat/copy the whole discussions again, onto this site.


Useful references

*    http://www.w3.org/TR/xslt (W3C Recommendation, XSLT 1.0)

*    http://www.w3.org/TR/xpath (W3C Recommendation, XPath 1.0)

*    http://www.w3.org/TR/xslt20 (W3C Recommendation, XSLT 2.0)

*    http://www.w3.org/TR/xpath20 (W3C Recommendation, XPath 2.0)

*    http://www.w3.org/TR/xpath-functions (W3C Recommendation, XQuery 1.0 and XPath 2.0 Functions and Operators)

*    http://www.w3.org/TR/xpath-datamodel (W3C Recommendation, XQuery 1.0 and XPath 2.0 Data Model)

*    XSL-List (XSL-List home page. An open forum for discussing XSL topics.)

*    http://xml.apache.org/xalan-j/ (Apache Xalan-Java: An open source XSLT Processor)

*    http://saxon.sourceforge.net/ (Saxon: An XSLT and XQuery Processor)

*    http://www.jenitennison.com/xslt/index.html (Jeni Tennison's XSLT Pages)

*    http://www.dpawson.co.uk/xsl/index.html (Dave Pawson's XSL FAQ)

*    http://www.zvon.org/xxl/XSL-Ref/Tutorials/index.html (XSLT 2.0 Tutorial, by Miloslav Nic)


XSLT tools

*    XSLTQual : Static code quality tool, for XSLT code


Interesting articles / papers related to XSLT

*    Functional programming library for XSLT    Dimitre Novatchev
*    Schema-aware processing with XSLT 2.0    my article on IBM, developerWorks
 



Home


Last Updated: Aug 25, 2012