ec2-34-232-62-64.compute-1.amazonaws.com | ToothyWiki | RecentChanges | Login | Webcomic

eXstensible Stylesheet Language Transformation

The transforming bit of XSL?. (The remainder is XSL-FO - a specific markup language for print, I think.)

It is an XML dialect, for specifying the transformation of XML documents into XML, HTML or arbitrary text documents. Interpreters include Saxon, and quite likely your web browser.

It is almost a FunctionalProgrammingLanguage, except that the equivalent of functions, templates, are not first class objects. There are strictly no side-effects to an XSL transformation.
To clarify that, XSLT uses XPath expressions, which have no way to refer to templates. You can invoke XPath functions in an XPath expression. There is a non-standard extension in Saxon (and maybe some other processors) which lets you declare functions in XSLT with an equivalent syntax to named templates, which can then be used in XPath expressions.


<xsl:stylesheet version="1.0">

<xsl:template match="item">
<div class="item">
<div class="header"><xsl:apply-templates select="title" /></div>
<div class="content"><xsl:apply-templates select="content" /></div>

<xsl:template match="emph">
<xsl:apply-templates />

<!-- catch-all to copy and process otherwise-unmatched nodes -->
<xsl:template match="node()|@*">
<xsl:apply-templates select="@*" />
<xsl:apply-templates select="node()" />


translates this:

<content>Welcome to this <emph>thing</emph></content>

into this:

<div class="item">
<div class="header">Introduction</div>
<div class="content">Welcome to this thing</div>


ec2-34-232-62-64.compute-1.amazonaws.com | ToothyWiki | RecentChanges | Login | Webcomic
Edit this page | View other revisions | Recently used referrers
Last edited July 17, 2007 2:04 pm (viewing revision 2, which is the newest) (diff)