xsl-list
[Top] [All Lists]

[xsl] how to do set operations (intersection, unify, relative compelent) on sequences (or any other possible structure); runtime dynamical structures?

2009-05-10 14:15:38
Hello,

I have a another question:
I have one sequence. In runtime I generate another one.
Now I need a relative complement of the first to the second (all the items
that are in 1st sequence, but are not in the second).
The first sequence for me is tags that I need to generate in the output. The
second sequence is tags that I have found data for in input, have processed
them and have generated tags to output. The relative complement is then the
set of tags of which data I did not encounter while processing input, thus I
need to generate them with some default values.

Is there some good way to do so? Should I be using some other structure
instead of sequences? (now I have a sequence of strings that represent XML
tags)

Or other way, is it possible to extract items from the sequence in runtime?
E.g. in a for-each loop? So that in the end that sequence will contain only
those tags that I did not find data for. The problem I have now is if I use
remove($list,index), then it returns a new list without that item. I cannot
change the original list itself, the only thing I can do now to remember
this newly generated list is to recursively call the same function again and
give it this new list as the parameter. However I see this as very
uneffective, since then the function will start the for-each loop again from
the first node and go through all the already processed data again...

The only way I have found to dynamically preserve in-loop generated data is
to <xsl:variable>
        <xsl:for each>
                <xsl:sequence>    <--here I dynamically add data to that
variable
        </for each>
   </variable>

Thanks again for any advice,

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