Subject: [xsl] XSLT result tree fragment, with XSLT 3.0 and xsl:variable From: "Mukul Gandhi mukulg@xxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Mon, 10 Apr 2023 11:41:22 -0000 |
Hi all, 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 visible. 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 constructor. 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's 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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] QA plugin and "Internal S, Michael Kay michaelk | Thread | Re: [xsl] XSLT result tree fragment, G. Ken Holman g.ken. |
Re: [xsl] QA plugin and "Internal S, Michael Kay michaelk | Date | Re: [xsl] XSLT result tree fragment, G. Ken Holman g.ken. |
Month |