xsl-list
[Top] [All Lists]

Re: Processing multiple lists

2005-09-07 10:00:49
Tempore 17:00:22, die 09/07/2005 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Emerson, Matt 
<Matt(_dot_)Emerson(_at_)FMR(_dot_)COM>:

That seems like a reasonable approach.  Do you know how I could
construct the string from the nodeset?

Suppose the input is:

<root>
        <list1>
                <node id="1">....stuff....</node>
                <node id="2">....stuff....</node>
                <node id="3">....stuff....</node>
                <node id="4">....stuff....</node>
                <node id="5">....stuff....</node>
                <node id="6">....stuff....</node>
        </list1>
        <list2>
                <node id="1">....stuff....</node>
                <node id="2">....stuff....</node>
                <node id="3">....stuff....</node>
                <node id="4">....stuff....</node>
                <node id="5">....stuff....</node>
                <node id="6">....stuff....</node>
        </list2>
        <list3>
                <node id="1">....stuff....</node>
                <node id="2">....stuff....</node>
                <node id="3">....stuff....</node>
                <node id="4">....stuff....</node>
                <node id="5">....stuff....</node>
                <node id="6">....stuff....</node>
        </list3>
</root>

Than you can construct the test-result string with:

<xsl:variable name="test-result">
        <xsl:for-each select="/root/list2/node">
                <xsl:value-of select="number(@id mod 2=0)"/>
        </xsl:for-each>
</xsl:variable>

The test itself is contained inside the 'number()' function. In this example it 
checks wether the id number is even or odd, producing '010101'

('1' and '0' are easier to construct than 'Y' and 'N' - no additional tests 
needed)

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
«In the land of the blind, the one-eyed man is king»

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