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

Subject: Re: [xsl] How to implement a sequence of sequences?
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Fri, 8 Oct 2010 22:26:56 +0200
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.

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

And have your sequence as:
(generate-id($seqs/seq[1]), generate-id($seqs/seq[2]), generate-id
($seqs/seq[3]))

You can dereference the sequence items by
<xsl:key name="node-by-id" match="node()" use="generate-id()"/>
to get the "containing" node and ??? to access the real sequence then ...


These ideas are inspired by "XSLT pointers" posting [1] and might be just
impossible in XSLT 2.0.


[1]
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201009/msg00180.html


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler, L3
Fixpack team lead
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


From:       "Costello, Roger L." <costello@xxxxxxxxx>
To:         "xsl-list@xxxxxxxxxxxxxxxxxxxxxx"
            <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Date:       10/08/2010 09:23 PM
Subject:    [xsl] How to implement a sequence of sequences?



Hi Folks,

My understanding is that in XSLT 2.0 there is no such thing as a sequence
of sequences. Thus, this sequence:

   ('red', (1, 2, 3), 'blue')

is flattened into one sequence consisting of 5 items:

   ('red', 1, 2, 3, 'blue')

However, I really need sequences of sequences.

What's the best way to implement sequences of sequences in XSLT 2.0?

Has anyone already implemented some XSLT functions that provide sequences
of sequences?

/Roger

Current Thread