xsl-list
[Top] [All Lists]

Re: [xsl] Problem with count iterate values

2009-09-17 06:26:52
You are wrong understand me. If I  have following xml:
<?xml version="1.0"?>
<?xml-stylesheet href="xsl.xsl" type="text/xsl" ?>
<elements>
        <Row Nr="1">
                <value>1</value>
                <code>22</code>
        </Row>
        <Row Nr="2">
                <value>1</value>
                <code>1</code>
        </Row>
        
        <Row Nr="3">
                <value>2</value>
                <code>2</code>
        </Row>
        <Row Nr="4">
                <value>1</value>
                <code>2</code>
        </Row>
        <Row Nr="5">
                <value>44</value>
                <code>2</code>
        </Row>
        <Row Nr="6">
                <value>1</value>
                <code>0</code>
        </Row>
        <Row Nr="7">
                <value>11</value>
                <code>1</code>
        </Row>
        <Row Nr="8">
                <value>11</value>
                <code>1</code>
        </Row>
        <Row Nr="9">
                <value>13</value>
                <code>0</code>
        </Row>
        <Row Nr="6">
                <value>13</value>
                <code>1</code>
        </Row>
        <Row Nr="6">
                <value>14</value>
                <code>1</code>
        </Row>
</elements>

I would like to have output:
4 times the same value in file: 0 values
3 times the same value in file: 1 values
2 times the same value in file: 2 values
1 times the same value in file: 4 values
Template should accept Rows where <code> !=0
Element <value> it is some kind of not unique ID and I would like
count how many times for each one iterate


2009/9/17 Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de>:
J23 wrote:

<elements>
       <Row Nr="1">
               <value>1</value>
               <code>22</code>
       </Row>
       <Row Nr="2">
               <value>1</value>
               <code>1</code>
       </Row>

       <Row Nr="3">
               <value>2</value>
               <code>2</code>
       </Row>
       <Row Nr="4">
               <value>1</value>
               <code>2</code>
       </Row>
       <Row Nr="5">
               <value>44</value>
               <code>2</code>
       </Row>
       <Row Nr="6">
               <value>1</value>
               <code>0</code>
       </Row>
</elements>
expected output:
4 times the same value in file: 0 values

Why is that the expected output? The 'Row' elements with 'Nr' 1, 2, 4, 6 all
have a 'value' child element with contents '1'.
Shouldn't that result in
 4 times the same value in file: 1 value
?



--

       Martin Honnen
       http://msmvps.com/blogs/martin_honnen/

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



Kind regards
J23

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