xsl-list
[Top] [All Lists]

Re: [xsl] How to implement a sequence of sequences?

2010-10-08 15:34:56
On 08/10/2010 21:26, Hermann Stamm-Wilbrandt wrote:
Hi,

I am not used to do XSLT 2.0.

While the Pattern of a xsl:key has more options in 2.0 than in XLST 1.0
http://www.w3.org/TR/xpath20/#prod-xpath-KindTest

it seems not to allow to match a sequence.

Is it possible to "store" a sequence in a node?

I tried
    <xsl:variable name="s">
      <xsl:sequence select="for $v in 1 to 10 return $v"/>
    </xsl:variable>
but then $s is considered as string "1 2 3 4 5 6 7 8 9 10" and not as
sequence.

well actually $s is a document node with a text node child being the string



In case you could store a sequence in a node (how?) you could have
a variable holding all sequences in nodes like this (in $seqs):

If you wrapped an element around the string and used a schema aware processor you could schema type the element and then validate.

there are some restrictions though, as not all xpath sequences can be represented this way, for example the the sequence ("1 2", "3 4") can not.

<xsl:variable name="seqs"><seq>(1,2,3)</seq><seq>(4,5,6)</seq><seq>
(7,8,9)</seq></xsl:variable>


But as Dimitre just commented if you are going to go that far you could use element markup to also mark up the items in the sequence as well as the subsequence boundaries.


David



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>