XSLT: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 4: Line 4:


{{quotation|A transformation expressed in XSLT is called a stylesheet. A stylesheet contains a set of template rules. A template rule has two parts: a pattern which is matched against nodes in the source tree and a template which can be instantiated to form part of the result tree. This allows a stylesheet to be applicable to a wide class of documents that have similar source tree structures.}}
{{quotation|A transformation expressed in XSLT is called a stylesheet. A stylesheet contains a set of template rules. A template rule has two parts: a pattern which is matched against nodes in the source tree and a template which can be instantiated to form part of the result tree. This allows a stylesheet to be applicable to a wide class of documents that have similar source tree structures.}}
([http://www.w3.org/TR/xslt XSL Transformations (XSLT)], retrieved 19:39, 30 May 2007 (MEST))
([http://www.w3.org/TR/xslt XSL Transformations (XSLT)], retrieved 19:45, 30 May 2007 (MEST))


{{quotation | A transformation expressed in XSLT describes rules for transforming a source tree into a result tree. The transformation is achieved by associating patterns with templates. A pattern is matched against elements in the source tree. A template is instantiated to create part of the result tree. The result tree is separate from the source tree. The structure of the result tree can be completely different from the structure of the source tree. In constructing the result tree, elements from the source tree can be filtered and reordered, and arbitrary structure can be added.}}([http://www.w3.org/TR/xslt XSL Transformations (XSLT)], retrieved 19:39, 30 May 2007 (MEST))
{{quotation | A transformation expressed in XSLT describes rules for transforming a source tree into a result tree. The transformation is achieved by associating patterns with templates. A pattern is matched against elements in the source tree. A template is instantiated to create part of the result tree. The result tree is separate from the source tree. The structure of the result tree can be completely different from the structure of the source tree. In constructing the result tree, elements from the source tree can be filtered and reordered, and arbitrary structure can be added.}}([http://www.w3.org/TR/xslt XSL Transformations (XSLT)], retrieved 19:45, 30 May 2007 (MEST))


== Tutorial ==
== Tutorial ==
Line 14: Line 14:
== Links ==
== Links ==


== 2.1 Manuals  ==
=== Manuals  ===


* [http://www.mulberrytech.com/quickref/ Mulberry Tech Quick References for XSLT]. Useful!
* [http://www.mulberrytech.com/quickref/ Mulberry Tech Quick References for XSLT]. Useful!
* [http://www.xslfo.info/reference.aspx www.xslfo.info Reference manual]
* [http://www.xslfo.info/reference.aspx www.xslfo.info Reference manual]


== 2.2 Specifications, standards and official propaganda  ==
=== Specifications, standards and official propaganda  ===


=== Official Frameworks ===
;Official Frameworks


* http://www.w3.org/Style/ and http://www.w3.org/Style/XSL/
* http://www.w3.org/Style/ and http://www.w3.org/Style/XSL/
=== XML Specifications ===


* [http://www.w3.org/TR/xslt XSL Transformations (XSLT) Specification] W3C Recommendation 16 November 1999 (Note: you also need Xpath)
* [http://www.w3.org/TR/xslt XSL Transformations (XSLT) Specification] W3C Recommendation 16 November 1999 (Note: you also need Xpath)
Line 37: Line 35:
* [http://www.w3.org/TR/xquery-operators/ XQuery 1.0 and XPath 2.0 Functions and Operators]This is the specification for functions used both by XQuery 1 and XPath 2.0 (XSLT 2). This still missed a lot, e.g. trigonometric functions that are a must for any kind of visualization. See [http://www.exslt.org/  EXSLT extensions].
* [http://www.w3.org/TR/xquery-operators/ XQuery 1.0 and XPath 2.0 Functions and Operators]This is the specification for functions used both by XQuery 1 and XPath 2.0 (XSLT 2). This still missed a lot, e.g. trigonometric functions that are a must for any kind of visualization. See [http://www.exslt.org/  EXSLT extensions].


== 2.3 FAQ's ==
=== FAQ's ===


* [http://www.dpawson.co.uk/ XSL FAQ] (good information on XSLT, XPATH, FO)
* [http://www.dpawson.co.uk/ XSL FAQ] (good information on XSLT, XPATH, FO)
* [http://www.owal.co.uk:8090/asf/servlet/asf/screen/MainMenu/action/SetAll/screen/DisplayTopics/faq_id/276/project_id/18;jsessionid=b3z05ecq61 FOP FAQ]
* [http://www.owal.co.uk:8090/asf/servlet/asf/screen/MainMenu/action/SetAll/screen/DisplayTopics/faq_id/276/project_id/18;jsessionid=b3z05ecq61 FOP FAQ]


== 2.4 NewsGroups and Mailing Lists  ==
=== NewsGroups and Mailing Lists  ===


* [http://www.mulberrytech.com/xsl/xsl-list/ XSL List at MulBerry Tech] ([http://www.mulberrytech.com/xsl/xsl-list/archive/ archive])
* [http://www.mulberrytech.com/xsl/xsl-list/ XSL List at MulBerry Tech] ([http://www.mulberrytech.com/xsl/xsl-list/archive/ archive])


== 2.5 General Tutorials  ==
== General Tutorials  ==
 
(most are somewhat technical, see also general XML tutorials on [/guides/xml/pointers.html XML Pointers] )


* [[Image:stars3s.gif|***]] [http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html XSL Concepts and Practical Use ] by Paul Grosso and Norman Walsh
* [http://www.nwalsh.com/docs/tutorials/xsl/xsl/slides.html XSL Concepts and Practical Use ] by Paul Grosso and Norman Walsh
* [/guides/tie/tie.html See our own TIE slides ] (in French: XML, XSLT)
* [http://metalab.unc.edu/xml/books/bible/ Chapters from the XML bible] by E.R. Harold: XSLT, Xlinks and Xpointers. Direct acess: [http://www.ibiblio.org/xml/books/bible/updates/ Iblio]. See also his collection of [http://metalab.unc.edu/xml/slides/sd99east/ Slides] (full-day tutorial).
* [[Image:stars3s.gif|***]][http://metalab.unc.edu/xml/books/bible/ Chapters from the XML bible] by E.R. Harold: XSLT, Xlinks and Xpointers. Direct acess: [http://www.ibiblio.org/xml/books/bible/updates/ Iblio]. See also his collection of [http://metalab.unc.edu/xml/slides/sd99east/ Slides] (full-day tutorial).


== 2.6 XSLT Tutorials  ==
== 2.6 XSLT Tutorials  ==
Line 62: Line 57:
* [http://www.webreference.com/js/column100/ XML and XSLT Programming], a Webreference.com tutorial
* [http://www.webreference.com/js/column100/ XML and XSLT Programming], a Webreference.com tutorial
* [http://www.objectsbydesign.com/projects/xslt/xslt_by_example.html XSLT by example] at Objects by Design (They also have good XML->HTML tutorials)
* [http://www.objectsbydesign.com/projects/xslt/xslt_by_example.html XSLT by example] at Objects by Design (They also have good XML->HTML tutorials)
* [[Image:stars3s.gif|***]] [http://metalab.unc.edu/xml/books/bible/updates/14.html E.R. Harolds on-line Book Chapter on XSLT] (good, the book too btw)
* [http://metalab.unc.edu/xml/books/bible/updates/14.html E.R. Harolds on-line Book Chapter on XSLT] (good, the book too btw)
* [[Image:stars2s.gif|**]] [http://www-4.ibm.com/software/developer/library/hands-on-xsl/  Hands-on XSL, XSL for fun and diversion ] ( Don R. Day ). Explains nicely how a rule-based system works.
* [http://www-4.ibm.com/software/developer/library/hands-on-xsl/  Hands-on XSL, XSL for fun and diversion ] ( Don R. Day ). Explains nicely how a rule-based system works.
* [http://www.heise.de/ix/artikel/E/2001/01/167/01.shtml XSLT Tutorial I: Basics and first example application] at heise.de
* [http://www.heise.de/ix/artikel/E/2001/01/167/01.shtml XSLT Tutorial I: Basics and first example application] at heise.de
* [http://zvon.vscht.cz/HTMLonly/XSLTutorial/Books/Book1/index.html Introduction to XSL] On-line reference tool by Miloslav Nic (part of his [http://zvon.vscht.cz/ZvonHTML/Zvon/zvonTutorials_en.html zvon tutorials])
* [http://zvon.vscht.cz/HTMLonly/XSLTutorial/Books/Book1/index.html Introduction to XSL] On-line reference tool by Miloslav Nic (part of his [http://zvon.vscht.cz/ZvonHTML/Zvon/zvonTutorials_en.html zvon tutorials])
Line 77: Line 72:


== 2.7 XSLFO Tutorials  ==
== 2.7 XSLFO Tutorials  ==
(should be moved)


* [http://www.dpawson.co.uk/xsl/sect3/bk/index.html XSL-FO] (very good on-line BOOK)
* [http://www.dpawson.co.uk/xsl/sect3/bk/index.html XSL-FO] (very good on-line BOOK)
* [http://www.sun.com/software/xml/developers/fop/ FOP Slide Kit]. Technical article from Paul Sandoz (SUN) about slides with FOP
* [http://www.sun.com/software/xml/developers/fop/ FOP Slide Kit]. Technical article from Paul Sandoz (SUN) about slides with FOP
{| width="100%" cellspacing="1" bgcolor="#CCFFCC"
|
[#top  [[Image:xml-icon.gif|logo]] ]
| align="center" |
[#section1 <font size="-1">XSL @ TECFA</font>]
| align="center" |
[#section2 <font size="-1">Documentation</font>]
| align="center" |
[#section3 <font size="-1">XSL for programmers</font>]
| align="center" |
[#section4 <font size="-1">Software</font>]
| align="center" |
[#section5 <font size="-1">Examples</font>]
| align="center" |
[#section6 <font size="-1">Links</font>]
|}


= 3. XSL for programmers =
= 3. XSL for programmers =
Line 105: Line 84:


* [http://www.tonymarston.net/php-mysql/xsl.html Using PHP 5's XSL extension to perform XSL Transformations], tutorial by Tony Marston (8/2004)
* [http://www.tonymarston.net/php-mysql/xsl.html Using PHP 5's XSL extension to perform XSL Transformations], tutorial by Tony Marston (8/2004)
{| width="100%" cellspacing="1" bgcolor="#CCFFCC"
|
[#top  [[Image:xml-icon.gif|logo]] ]
| align="center" |
[#section1 <font size="-1">XSL @ TECFA</font>]
| align="center" |
[#section2 <font size="-1">Documentation</font>]
| align="center" |
[#section3 <font size="-1">XSL for programmers</font>]
| align="center" |
[#section4 <font size="-1">Software</font>]
| align="center" |
[#section5 <font size="-1">Examples</font>]
| align="center" |
[#section6 <font size="-1">Links</font>]
|}


= 4. Software =
= 4. Software =
Line 153: Line 115:
* [http://grillade.griotte.com/xml/ XSLTDoc], an XSLT stylesheet documentation generator (tested/works)
* [http://grillade.griotte.com/xml/ XSLTDoc], an XSLT stylesheet documentation generator (tested/works)
* [http://www.xslprofiler.org catchXSL], an XSL profiler from I3 written in Java, needs Xalan or Saxon.
* [http://www.xslprofiler.org catchXSL], an XSL profiler from I3 written in Java, needs Xalan or Saxon.
{| width="100%" cellspacing="1" bgcolor="#CCFFCC"
|
[#top  [[Image:xml-icon.gif|logo]] ]
| align="center" |
[#section1 <font size="-1">XSL @ TECFA</font>]
| align="center" |
[#section2 <font size="-1">Documentation</font>]
| align="center" |
[#section3 <font size="-1">XSL for programmers</font>]
| align="center" |
[#section4 <font size="-1">Software</font>]
| align="center" |
[#section5 <font size="-1">Examples</font>]
| align="center" |
[#section6 <font size="-1">Links</font>]
|}


= 5. Examples =
= 5. Examples =
Line 175: Line 120:
Showing context-free examples is a tricky issue, since tree transformations and rendering depends on specific DTDs and tasks.
Showing context-free examples is a tricky issue, since tree transformations and rendering depends on specific DTDs and tasks.


* [[Image:stars1s.gif|*]][http://www.CraneSoftwrights.com/resources/ XSL Tree Display Stylesheet] from Crane Softwrigthts Ltd. Usefull to check the node structure of a document !
* [http://www.CraneSoftwrights.com/resources/ XSL Tree Display Stylesheet] from Crane Softwrigthts Ltd. Usefull to check the node structure of a document !
* Look at some simple [/guides/xml/cocoon Cocoon examples ] (you need Netscape or know to make IE Internet compatible to look at sources)
* Look at some simple [/guides/xml/cocoon Cocoon examples ] (you need Netscape or know to make IE Internet compatible to look at sources)
* [http://www.sourcepole.com/sources/software/sp.xsl/ Sourcepole XSL package]
* [http://www.sourcepole.com/sources/software/sp.xsl/ Sourcepole XSL package]
* ... more needed here (including Tecfa's own)


{| width="100%" cellspacing="1" bgcolor="#CCFFCC"
= Other =
|
[#top  [[Image:xml-icon.gif|logo]] ]
| align="center" |
[#section1 <font size="-1">XSL @ TECFA</font>]
| align="center" |
[#section2 <font size="-1">Documentation</font>]
| align="center" |
[#section3 <font size="-1">XSL for programmers</font>]
| align="center" |
[#section4 <font size="-1">Software</font>]
| align="center" |
[#section5 <font size="-1">Examples</font>]
| align="center" |
[#section6 <font size="-1">Links</font>]
|}


= 6. Links =
* See the links on the [xml-pointers.html XML] page
* [http://www.xslt.com/ xslt.com]
* [http://www.xslt.com/ xslt.com]
* [http://finetuning.com/xsl.html Stylesheet Resources] (XSL/CSS/DSSL at finetuning.com
* [http://finetuning.com/xsl.html Stylesheet Resources] (XSL/CSS/DSSL at finetuning.com
[[Category: XML]]

Revision as of 18:45, 30 May 2007

Draft

Definition

“A transformation expressed in XSLT is called a stylesheet. A stylesheet contains a set of template rules. A template rule has two parts: a pattern which is matched against nodes in the source tree and a template which can be instantiated to form part of the result tree. This allows a stylesheet to be applicable to a wide class of documents that have similar source tree structures.” (XSL Transformations (XSLT), retrieved 19:45, 30 May 2007 (MEST))

“A transformation expressed in XSLT describes rules for transforming a source tree into a result tree. The transformation is achieved by associating patterns with templates. A pattern is matched against elements in the source tree. A template is instantiated to create part of the result tree. The result tree is separate from the source tree. The structure of the result tree can be completely different from the structure of the source tree. In constructing the result tree, elements from the source tree can be filtered and reordered, and arbitrary structure can be added.”(XSL Transformations (XSLT), retrieved 19:45, 30 May 2007 (MEST))

Tutorial

See XSLT Tutorial - Basics

Links

Manuals

Specifications, standards and official propaganda

Official Frameworks

FAQ's

NewsGroups and Mailing Lists

General Tutorials

2.6 XSLT Tutorials

IMPORTANT: Some tutorials do not respect the current XSLT Specification [don't have time to clean them ou :( ]

2.7 XSLFO Tutorials

(should be moved)

  • XSL-FO (very good on-line BOOK)
  • FOP Slide Kit. Technical article from Paul Sandoz (SUN) about slides with FOP

3. XSL for programmers

See the [/guides/xml/pointers.html XML Pointers] for now.

3.1 PHP's XSLT processor

4. Software

4.1 XSLT/FO Processors

  • SAXON The SAXON package is a collection of tools for processing XML documents, e.g. an XSL (XSLT and XPath).
    INSTALLED at Tecfa: [password protected local documentation]. Saxon has extension features that others (Xalan) have not.
  • Gnome LibXML2 and it's associated XSLT C library. Used in PHP 5.0. There also command line tools for batch use, including xsltproc that also does XInclude. Installed @ Tecfa
  • tkxsltproc is a GUI frontend for the Gnome libxslt packages (see above). MacOSX, Win, Linux [9/2004]
  • Sablotron Sablotron is a fast, compact and portable XML toolkit implementing XSLT 1.0, DOM Level2 and XPath 1.0. Has some extensions, e.g. multiple output files. This is also the library used in PHP 4.x
  • Apache / Xalan-J is a Java-based XSLT 1.0 processor. Works with Xerces-Java (XML parser). Both are also distributed with other Apache products, like FOP. (installed @ Tecfa)
  • Apache / FOP is the world's first print formatter driven by XSL formatting objects. It is a Java application that reads a formatting object tree and then turns it into a PDF document. Installed @ Tecfa.
  • xmlroff. Sun sponsored xsl formatter for productin PDF and PS (2/2003). Early Beta, [not tested yet].

4.2 XSLT Libraries

4.3 Editors and Modes

  • Stylus XSLT Editor is part of Stylus XML editor (Windows, payware = $275 academic, 30 Day demo, home edition = $49)
  • XSLT-process is a minor mode for GNU Emacs/XEmacs which transforms it into a powerful editor with XSLT processing and debugging capabilities (For people who know Emacs!)

4.4 Other tools

  • XSLTDoc, an XSLT stylesheet documentation generator (tested/works)
  • catchXSL, an XSL profiler from I3 written in Java, needs Xalan or Saxon.

5. Examples

Showing context-free examples is a tricky issue, since tree transformations and rendering depends on specific DTDs and tasks.

  • XSL Tree Display Stylesheet from Crane Softwrigthts Ltd. Usefull to check the node structure of a document !
  • Look at some simple [/guides/xml/cocoon Cocoon examples ] (you need Netscape or know to make IE Internet compatible to look at sources)
  • Sourcepole XSL package

Other