Shallow copy in XSLT with maps and arrays #1777
Labels
Enhancement
A change or improvement to an existing feature
Reviewed-required
Triage suggests this issue must be resolved for 4.0
XSLT
An issue related to XSLT
Currently the
xsl:copy
instruction, if applied to a map or array, does a deep copy, and ignores the content of the contained sequence constructor.I propose that if the contained sequence constructor is non-empty then instead of ignoring it, we should use it to create the content of the new map or array. Specifically, for maps xsl:copy will behave essentially like xsl:map, and for arrays it will behave essentially like xsl:array.
This is an incompatibility with 3.1, but since a contained sequence constructor is currently totally useless in this situation, it doesn't seem likely to cause any trouble.
I also propose that rather than using the new built-in
on-no-match="shallow-copy-all
, we should extend the semantics ofshallow-copy
to cover maps and arrays (as currently defined forshallow-copy-all
). Again, there is an incompatibility, but the current rules are so unhelpful that it's unlikely people are relying on them.I also propose that when apply-templates is applied to a map or array, it should be automatically pinned if it is not pinned already. The means that match patterns can be used with a lot more context to match the deep contents of the map or array and override the processing of the built-in templates.
And I propose that when apply-templates is applied to a map or array and there is no
select
attribute, it should "do the right thing" by applying templates to the map or array contents, rather than using the useless default ofchild::node()
.The text was updated successfully, but these errors were encountered: