Hi Varun,
The problem is in your xpath expression. The path returns 1 because
you are actually counting the <products /> element.
You could try something like the following depending how exact you
want to make your query.
count(//type[text()='ABC'])
but I think the path you are looking for is actually:
count(/yearly/year/products/type[text()='ABC'])
Best of luck,
-Jacobd

On 7/11/07, unni_varun <[EMAIL PROTECTED]> wrote:

hi,

my input xml is the foll:
        <yearly>
                <year ending="Jul-2007">
                        <inquiry>11</inquiry>
                        <products>
                                <type>ABC</type>
                                <type>ABC</type>
                                <type>ABC</type>
                                <type>ABC</type>
                                <type>ABC</type>
                                <type>DEF</type>
                                <type>DEF</type>
                                <type>DEF</type>
                                <type>DEF</type>
                                <type>DEF</type>
                                <type>DEF</type>
                        </products>
                        </year>
         </yearly>

now <xsl:value-of select="count(yearly/year/products[type='ABC'])"/> is
giving the value as 1, i need the output as 5 because ABC appears 5 times.
Please give ur comments.

thanks in anticipation
Varun

--
View this message in context: 
http://www.nabble.com/using-count%28%29--for-counting-tags-with-a-particular-value-tf4060347.html#a11535550
Sent from the Xml Beans - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to