Saxon extensions to the W3C XSLT/XQuery specifications
Changes to EXPath functions
The implementations of the EXPath binary and file module functions have been updated to conform to the new 4.0 specifications. Changes apply whether or not 4.0 is enabled.
-
The handling of byte order marks in
bin:encode-stringandbin:decode-stringhas been clarified in the specification, and this has resulted in changes to the Saxon implementation. The changed behaviour applies whether or not 4.0 is enabled. (PR 1765) -
The non-standard function
bin:versionis dropped. -
The new EXPath function
bin:infer-encodingis implemented. -
The new EXPath functions
file:is-absolute,file:list-rootsandfile:descendantsare not yet implemented. -
The new
fallbackoption for thefile:read-textandfile:read-text-linesfunctions is not yet implemented.
Dropped experimental features
Some proposed enhancements that didn't survive into the current 4.0 draft specifications have been dropped:
-
The ternary conditional expression
test ?? A !! B. -
Record types using the keyword "tuple" rather than "record".
-
Extensible record types.
-
The syntax for defining recursive record types has changed: the use of ".." as a reference to the containing type has been dropped. (In the current 4.0 specification recursive record types can be created by allowing the definition of a named record type to include a reference to itself; but note that named record types are not yet implemented in Saxon.)
-
Item types of the form
"atomic(X)". -
The syntax
type(T)is dropped. A type aliasTis now referenced simply asT, nottype(T). In XSLT patterns, a match for items of typeTis writtenmatch="~T"rather thanmatch="type(T)". -
Local union types have been generalized to choice types; the syntax
union(xs:int, xs:long)is dropped, replaced by(xs:int | xs:long), and unions of other types are allowed (for example(map(*) | array(*)). -
Lambda expressions of the form
($a, $b) -> {$a + $b}. -
The "thin arrow" notation for inline functions (
->{.+1}or->($x){$x+1}). These are now writtenfn{.+1}orfn($x){$x+1}respectively. -
Saxon's experimental operators
andAlsoandorElseare dropped. The 4.0 specification definesandandorto have short-cut semantics, so these operators are unnecessary. -
fn:allis renamedfn:every. -
fn:contains-sequence,fn:ends-with-sequenceandfn:starts-with-sequenceare renamedfn:contains-subsequence,fn:ends-with-subsequenceandfn:starts-with-subsequencerespectively. -
fn:intersperseis renamedfn:insert-separator. -
The functions
fn:items-after,fn:items-before,fn:items-ending-where,fn:items-starting-whereare dropped. (The alternative original Saxon namespace functions remain available:saxon:items-after,saxon:items-before,saxon:items-from,saxon:items-until.) -
The function
fn:iterate-whileis replaced byfn:while-doandfn:do-until. - The functions
fn:parcelandfn:unparcelare dropped. In Saxon 12,fn:parcel($x)simply did{'value': $x}, andfn:unparcel($p)simply did$p?value. -
The function
fn:partsis dropped. - The
fn:pinandfn:labelfunctions are dropped (replaced by JNodes). For the time being, though, thesaxon:deep-updateextension instruction continues to use pinned and labelled items; this is likely to change in due course. -
The function
fn:xdm-to-jsonis dropped. -
The function
array:existsis dropped. -
The function
array:ofis renamedarray:of-members. -
The function
array:replaceis dropped. -
The function
map:indexis dropped. -
The second argument for
map:keysis dropped. -
The proposed
map:keys-wherefunction is dropped. -
The functions
map:pair,map:pairsandmap:of-pairsare dropped.
Dropped or changed extension functions
Some Saxon extension functions that were essentially prototypes of near-identical XPath 4.0 functions are dropped:
-
saxon:analyze-uriis dropped, superseded byfn:parse-urifrom the 4.0 specification. -
saxon:array-memberis dropped. A call onsaxon:array-member(x)can be replaced with the expression{'value': x}. -
saxon:highestandsaxon:lowestare dropped, superseded byfn:highestandfn:lowestfrom the 4.0 specification. -
saxon:indexis superseded bymap:build. -
saxon:index-whereis superseded byfn:index-where. -
saxon:is-NaNis dropped, superseded byfn:is-NaN. -
saxon:parse-htmlis superseded byfn:parse-html, but note that the specification forfn:parse-htmlhas changed. -
saxon:pedigreeandsaxon:with-pedigreeare dropped. Applications using these functions should be rewritten to use JNodes, which build on the same idea but provide much more flexibility.
The undocumented functions saxon:create-map and saxon:map-as-sequence-of-maps are dropped.
The extension functions saxon:line-number and saxon:column-number
now return an empty sequence if the argument value is an empty sequence.
New extension functions
The new functions saxon:compose and saxon:generate-sequence are implemented.
Dropped or changed XSLT extensions
A new vendor option has been added to the fn:transform function. Setting
the option saxon:write-result-documents to true() changes the
way the output of xsl:result-document instructions is handled. Instead of
being returned in the result map returned by fn:transform, they are handled
by the result document handler registered with the primary transformation, or the default
result document handler otherwise: this has the effect of writing the secondary results
directly to filestore.
The saxon:array and saxon:array-member instructions are dropped
in favour of their XSLT 4.0 counterparts, xsl:array and
xsl:array-member. Note that the XSLT 4.0 specification for
xsl:array has changed to drop the composite attribute, and add
the for-each attribute.
The saxon:item-type instruction is dropped, superseded by xsl:item-type
from the XSLT 4.0 specification.
The saxon:as extension attribute is deprecated; the standard as
attribute can now be used in its place.
The xsl:map/@saxon:on-duplicates extension attribute is no longer supported, it is
replaced by the regular XSLT 4.0 attribute xsl:map/@duplicates.
Similarly the saxon:on-duplicates option of the map:merge
function is replaced by the regular 4.0 option duplicates.
The xsl:accumulator-rule/@saxon:capture extension attribute is deprecated;
it is replaced by the regular XSLT 4.0 attribute xsl:accumulator-rule/@capture.
The extension instruction saxon:tabulate-maps is dropped, as it depends
on features like pins and labels that were proposed for XPath 4.0 but subsequently replaced
by JNodes. Practical use cases for saxon:tabulate-maps can readily be rewritten
to use JNode-based path expressions: the example previously in the documentation:
might become:
<xsl:variable name="root" select="parse-json($input) -> jtree()"/> <xsl:select> array { for $e in $root/*/cities/* return map:merge(($e, {'_keys': array { ancestor-or-self::* ! jkey() } }, ancestor::map(*)/child::type(xs:anyAtomicType) )) } </xsl:select>