xsl-list
[Top] [All Lists]

Re: [xsl] Question about variable definition and types

2008-03-07 04:32:25
Am 07.03.2008 um 11:20 schrieb Andrew Welch:

The presence of the attribute "as" determines whether the value of
the variable is evaluated to a sequence or a temporary tree


[snip]

 Ah.... thanks for the explanation.  That clears up a lot :-)

It's worth adding the when you do as="element()+" the elements
represented by that variable aren't siblings because they don't have a
common parent.

<xsl:variable name="foo" as="element()+">
  <a/>
  <b/>
</xsl:variable>

here a/following-sibling::b returns false

...so it's worth bearing that in mind when deciding what the as
attribute should be.

So

<xsl:variable name="foo" as="document-node()">
  <a/>
  <b/>
</xsl:variable>

would be the equivalent of (identical to?) an un-typed variable and allow siblings?

- Michael


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--