Re: [xsl] Content constructors and sequences

Subject: Re: [xsl] Content constructors and sequences
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 9 Jan 2002 12:14:37 GMT

Jeni
> [I don't think that people get the string values of result tree
>  fragments that contain elements very often because it's rarely useful
>  to create a result tree fragment with internal structure and then
>  proceed to ignore that internal structure, but it does happen.]


Actually I have stylesheets (production ones, not toy answers for this
list) that use rtf precisely to gain that effect. For some uses you
want to discard the markup in document oriented cases where "markup"
is being used as originally intended, as an annotation on text that is
usable without the markup, and I want, in some cases to get rid of this
annotation. Often it's easier to build an rtf first as you just copy
some filtered branch of a tree so get the markup as well...



 
> These backwards compatibility issues could be resolved by having the
> type attribute on the variable-binding element determine the behaviour
> of the variable-binding element. If the type attribute is not present,
> then the variable-binding element creates a result tree (as described
> later), and the variable is bound to a new document node; if the type
> attribute is specified, then the variable is bound to the sequence.

I'm not sure what the type would be though for "sequence of whatever
gets constructed, be it nodes or values of any type".

Having xsl:variable generate a root node by default does have some
advantages as well as compatibility

<xsl:variable name="x">
<a/>
<b/>
<c/>
<a/>
</xsl:variable>

in xslt 1.0 you go ext:node-set($x)/a to access the a's
in xslt 2.0 current draft you go $x/a (which seems quite nice)
if the above generated a sequence then you'd have to go
$x[self::a] which isn't totally horrible but isn't as nice as
$x/a.

So while I do think the general direction of your proposal is correct
(allow XSLT to create constructs in the data model rather than
pushing control constructs into Xpath)

As for rootless nodes I think there are some problems with defining /
(and the new xpath 2 shared namespace nodes) when there is no document
(and id() and key() and any other function that has a definition
involving the "current document") but they are probably not
insurmountable. 

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread