Reputation: 1111
There are 24 rows returned by my dataview webpart. There's a column called NoExperience which has a number type. For some rows, it has value for NoExperience and some rows don't contain value for NoExperience. I only need to count the number in NoExperience column that would indicate total # of non empty value for that column. Sort of COUNTA function in Excel.
I m using xsl 1.0.
Any help?Below is my line of code. This always return 24. There are 10 non empty values for NoExperience column. I need to find that number.
<xsl:value-of select="count(/dsQueryResponse/Rows/Row/@NoExperience)" />
In XPAth builder the value of @NoExperience shows like this: ; ; ; ; ; ; ; 6; 6; ; 6; ; ; ; 6; ; 7; 7; ; ; 9; 9; 9; 9;
There are 10 non empty values.
Upvotes: 1
Views: 2507
Reputation: 5652
Presumably the "empty" case has <Row NoExperience="">
rather than the attribute not being there at all, so you need something like
<xsl:value-of select="count(/dsQueryResponse/Rows/Row/@NoExperience[string(.)])" />
as a non empty string value will act as a true predicate.
Upvotes: 5