
Caveat: While I have seen a few presentations on XSLT 3.0, I have never actually written a working XSLT 3.0 program. (Or at least, not working the way I want it to. :-) Some of the advantages of XSLT 3.0: 1) xml-to-json() and json-to-xml() 2) You can use the || operator instead of concat(). 3) text templates (i.e., you can insert XPath into text by enclosing it in curly braces. E.g. <span class="label">[{ normalize-space(.)||'-'||position() }]</span> This feature is turned on or off by @expand-text on the root element). 4) The bang operator (which *is* the map operator) allows XPaths to contain functions, as it were. It says "for each item on my left, perform the thing on my right, and append the result to the output I'm bulding" or something like that, at least. 5) Function chaining is done with the arrow operator. So the following (taken from odd2relax) | distinct-values( tokenize( normalize-space($exclude), '\s+') ) could be written as | normalize-space($exclude) => tokenize('\s+') => distinct-values() which is to some folks much easier to read. 6) Functions can be created anonymously, and refered to in a variable. (This is *very* powerful, but a bit confusing.) 7) Special handling of the last item of the sequence can be done more naturally using <xsl:iterate> and <xsl:on-completion> rather than <xsl:for-each> and a conditional test to see if you're on the last item or not. There are *lots* of other improvements that I don't understand (or, in rare cases, do understand but don't care about, e.g. streaming). Probably a good place to read up on this stuff is our own David Birnbaum's take on it: http://dh.obdurodon.org/xslt3.xhtml

David's page is a helpful quick summary! Thanks for posting it. The one piece of XSLT 3.0 that I have been using since last year is the much-simplified identity transformation: <xsl:mode on-no-match="shallow-copy"/> I love this for teaching my students--it's much easier to explain and write, and for the past year it's the first XSLT they write in my coding class (an identity transformation that changes some elements and adds some numbering attributes). I haven't tried the other stuff (yet). :-) Elisa On Thu, Aug 31, 2017 at 12:09 PM, Syd Bauman <s.bauman@northeastern.edu> wrote:
Caveat: While I have seen a few presentations on XSLT 3.0, I have never actually written a working XSLT 3.0 program. (Or at least, not working the way I want it to. :-)
Some of the advantages of XSLT 3.0:
1) xml-to-json() and json-to-xml()
2) You can use the || operator instead of concat().
3) text templates (i.e., you can insert XPath into text by enclosing it in curly braces. E.g. <span class="label">[{ normalize-space(.)||'-'||position() }]</span> This feature is turned on or off by @expand-text on the root element).
4) The bang operator (which *is* the map operator) allows XPaths to contain functions, as it were. It says "for each item on my left, perform the thing on my right, and append the result to the output I'm bulding" or something like that, at least.
5) Function chaining is done with the arrow operator. So the following (taken from odd2relax) | distinct-values( tokenize( normalize-space($exclude), '\s+') ) could be written as | normalize-space($exclude) => tokenize('\s+') => distinct-values() which is to some folks much easier to read.
6) Functions can be created anonymously, and refered to in a variable. (This is *very* powerful, but a bit confusing.)
7) Special handling of the last item of the sequence can be done more naturally using <xsl:iterate> and <xsl:on-completion> rather than <xsl:for-each> and a conditional test to see if you're on the last item or not.
There are *lots* of other improvements that I don't understand (or, in rare cases, do understand but don't care about, e.g. streaming).
Probably a good place to read up on this stuff is our own David Birnbaum's take on it: http://dh.obdurodon.org/xslt3.xhtml -- tei-council mailing list tei-council@lists.tei-c.org http://lists.lists.tei-c.org/mailman/listinfo/tei-council
PLEASE NOTE: postings to this list are publicly archived
-- Elisa Beshero-Bondar, PhD Director, Center for the Digital Text | Associate Professor of English University of Pittsburgh at Greensburg | Humanities Division 150 Finoli Drive Greensburg, PA 15601 USA E-mail: ebb8@pitt.edu <ebb8@pitt.edu> Development site: http://newtfire.org
participants (2)
-
Elisa Beshero-Bondar
-
Syd Bauman