Subject: Re: [xsl] XSLT result tree fragment, with XSLT 3.0 and xsl:variable From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 10 Apr 2023 12:32:00 -0000 |
Mukul, my pedantic concerns about your text here relate to the distinction between nodes and XML syntax.
XSLT 1.0 result tree fragments were exactly that: fragments of the result tree of nodes ... that happen to be serialized as XML syntax if the user intended to create XML syntax. But XSLT guides the creation of result tree nodes from source tree nodes based on stylesheet tree nodes. If the XSLT is an intermediate step of the manipulation of trees of content, then XML syntax doesn't come into play.
XML only comes out if the result tree is serialized as XML (and there are other choices, as you know, for serialization syntax).
> It seems to me that, XSLT 1.0's "result tree fragment" (before > being serialized to the output XML) is a well-formed XML fragment.
... I don't agree it is a well-formed XML fragment. It is a fragment of a node tree, so a bunch of nodes, which can be serialized as XML syntax, and that serialization ensures each XML element node is well-formed.
If in the completed result tree there are zero or more than one apex element nodes, the tree is serialized as an external XML entity. If there is one apex element node in the fragment, it is serialized as an XML document.
So my counsel is to reflect in your text that the languages are creating sequences of nodes to be serialized and that XML only happens if serialization is engaged and is engaged requesting XML syntax.
visible.Hi all, B B While comparing the, data models of XPath 1.0 and 3.1 languages (in the context of XSLT transformations), I noticed that, XSLT 3.0 doesn't have (i.e, it doesn't define) a data type named as "result tree fragment" Whereas, the data type "result tree fragment" is available with XSLT 1.0.
With respect to this topic, I've been comparing the semantics of XSLT xsl:variable instruction within 1.0 and 3.0 versions of XSLT language.
1) From the XSLT 1.0 spec A variable is a name that may be bound to a value. The value to which a variable is bound (the value of the variable) can be an object of any of the types that can be returned by expressions. There is a region of the stylesheet tree within which the binding is
constructor.
Result Tree Fragments Variables introduce an additional data-type into the expression language. This additional data type is called result tree fragment. A variable may be bound to a result tree fragment instead of one of the four basic XPath data-types (string, number, boolean, node-set). A result tree fragment represents a fragment of the result tree.
2) From the XSLT 3.0 spec The value of the variable is computed using the expression given in the select attribute or the contained sequence
I think, from the point of view of XSLT language in general, "result tree fragment" (from XSLT 1.0) and "sequence constructor" (from XSLT 3.0) both serialize into the XSLT transformation'sB output (which typically would be XML for this discussion). The XSLT 3.0 sequence constructor, shall result in a value with a XPath 3.1 data type item()+. The XSLT 3.0 language, defines "sequence constructor" as : A sequence constructor is a sequence of zero or more sibling nodes in the stylesheet that can be evaluated to return a sequence of nodes, atomic values, and function items.
It seems to me that, XSLT 1.0's "result tree fragment" (before being serialized to the output XML) is a well-formed XML fragment. Whereas, XSLT 3.0's sequence constructor is also a well-formed XML fragment, that evaluates to a sequence of nodes, atomic values, and function items. Other than, the XPath 3.1 function items (which is not available with XSLT 1.0/XPath 1.0), XSLT 3.0's sequence of nodes and atomic values looks to me, an intermediate compiler representation that is finally transformed into the XML document available as a result of XSLT transformation.
Any thoughts about this topic, shall be useful to know.
-- Regards, Mukul Gandhi <http://www.mulberrytech.com/xsl/xsl-list>XSL-List info and archive <http://lists.mulberrytech.com/unsub/xsl-list/96802>EasyUnsubscribe (<>by email)
-- Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/s/ | Check our site for free XML, XSLT, XSL-FO and UBL developer resources | Streaming hands-on XSLT/XPath 2 training class @US$125 (5 hours free) | Essays (UBL, XML, etc.) http://www.linkedin.com/today/author/gkholman |
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT result tree fragment, wi, Mukul Gandhi mukulg@ | Thread | Re: [xsl] XSLT result tree fragment, Mukul Gandhi mukulg@ |
[xsl] XSLT result tree fragment, wi, Mukul Gandhi mukulg@ | Date | Re: [xsl] XSLT result tree fragment, Mukul Gandhi mukulg@ |
Month |