xsl-list
[Top] [All Lists]

[xsl] Testing if all child nodes match (based on the value of certain elements)

2007-04-23 13:24:51
Hi All

I'm stuck with trying to figure something out in an XSL style sheet. I
can't post may actual data, as it's confidential, so I've made up an
example:

<group>
        <person>
                <name>John</name>
                <age>42</age>
                <sex>M</sex>
                marital_status>S<marital_status>
        </person>
        <person>
                <name>Fred</name>
                <age>42</age>
                <sex>M</sex>
                <marital_status>W<marital_status>
        </person>
        <person>
                <name>Harry</name>
                <age>42</age>
                <sex>M</sex>
                <marital_status>M<marital_status>
        </person>
        <person>
                <name>Brian</name>
                <age>42</age>
                <sex>M</sex>
                <marital_status>S<marital_status>
        </person>
</group>

What I want to do is find out if the group contains all people of the
same sex and age (in this case it does). So in my example xml structure,
for every person in the group <age> and <sex> must be the same (but I've
no idea what their values will be at run time: i.e. I can't check if age
is '42' and sex = 'M').

I've puzzled over this for some hours with no luck.

Any help is greatly appreciated.

TIA

Mark 

  



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