[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XSLT 3.0 features in Saxon 9.5


Subject: [xsl] XSLT 3.0 features in Saxon 9.5
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 24 Apr 2013 18:29:03 +0100

I thought that some of you who like to stay close to the bleeding edge might
like to try out some of the new XSLT 3.0 features implemented in Saxon 9.5.

These include:

* composite grouping keys

for example <xsl:for-each-group group-by="first, last" composite="yes">

* accumulators (a big subject that deserves a tutorial)

* xsl:number start-at="5" to start numbering from something other than 1.

* xsl:assert

* xsl:map and xsl:map-entry so you can now construct maps at the XSLT level,
not only at the XPath level

* content value templates, for example

<title>Chapter {$number}</title>

- needs to be enabled with expand-text="yes" for compatibility reasons

- unlike XQuery, the expansion always yields a string, not elements or
attributes.



Accumulators, like xsl:iterate and some other XSLT 3.0 features, were
introduced primarily for streaming use cases, but I think they might well
prove handy even where streaming isn't a requirement. They basically give you
the ability to compute a value during a tree-walk of a document, passing the
accumulated value both up and down the tree; in FP terms, a sort of tree-fold
operation. If we didn't already have xsl:key, for example, you could use an
accumulator to construct an index for a document in the form of a map. I'm
sure there are people on this list who will come up with creative applications
for them...

Saxon releases don't coincide exactly with W3C working drafts so some of the
features implemented in 9.5 won't actually be published until the next WD, and
in some cases there may have been spec changes between the last public WD and
the Saxon implementation. I did say it was bleeding edge.

Michael Kay
Saxonica


Current Thread
Keywords