The Lanham Factor

Balancing the Technology-Business Equation

  Home  |   Contact  |   Syndication    |   Login
  127 Posts | 2 Stories | 116 Comments | 106 Trackbacks

News

Article Categories

Archives

Post Categories

Image Galleries

BLOGS

Companies

My Articles

Does anyone reading this have an XSLT script that determines the number of elements in an XML file (obviously) with a certain attribute equal to a certain value?  For example, suppose you have an XML file similar to the following:

<root>

     <someElem Status="closed"/>

     <someElem Status="open"/>

</root>

I want to count the number of "closed" items, etc.  I have some references and books but it's becoming a big hassle.  They all seem to want to specify the query using Elements instead of Attributes.  Thanks in advance!

posted on Tuesday, February 26, 2008 6:33 AM

Feedback

# re: XSLT Anyone? 2/26/2008 6:56 AM Ivan Pepelnjak
<xsl:select value="count(//*[@Status = 'closed'])" />

# re: XSLT Anyone? 2/26/2008 6:59 AM Ivan Pepelnjak
Sorry, should have been

<xsl:value-of select="count(//*[@Status = 'closed'])" />

The flu is obviously cooking my brains :(

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: