xsl-list
[Top] [All Lists]

how to update a variable (grouping question)

2005-08-08 18:48:19
I am trying to retrieve data from a table structure (xml table) where
after every few rows a special row appears which contains a piece of
data which is relevant to rows appearing immidiatley after it (i.e.
its next few siblings).  I am having hard time figuring out how to
achieve this without a dynamically assigned variable in XSL.

Test data looks like this:

<schedule>
        <row type="header">
                <col>January</col>
                <col>Opponent</col>
        </row>
        <row type="data">
                <col>10 at 6pm</col>
                <col>Dallas</col>
        </row>
        <row type="data">
                <col>21 at 8pm</col>
                <col>New York</col>
        </row>
        <row type="data">
                <col>31 at 8pm</col>
                <col>Chicago</col>
        </row>
        <row type="header">
                <col>March</col>
                <col>Opponent</col>
        </row>
        <row type="data">
                <col>16 at 9pm</col>
                <col>Houston</col>
        </row>
        <row type="data">
                <col>31 at 7pm</col>
                <col>Sacramento</col>
        </row>
</schedule>

and the desired output is:
<schedule>
        <date>January 10 at 6pm</date>
        <date>January 21 at 8pm</date>
        <date>January 31 at 8pm</date>
        <date>March   16 at 9pm</date>
        <date>March   31 at 7pm</date>
</schedule>

basically what I am trying to figure out is how I can save the value
of col[1] in a varaible WHEN row[(_at_)type='header'] and then append the
value of this variable to all of the following col[1] values UNTIL the
next row[(_at_)type='header] is reached ?

Any suggestions, pointers, hints  ?

-sm

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