Sharepoint Designer XSLT count boolean node = true
I have a SharePoint list I converted to XSLT to do some additional grouping and counting and percentages. I need to return the number of items = true within my nodeset, I have:
<xsl:value-of select="count($nodeset/@PartnerArrivedAtCall)"/>
(which returns the count of all the nodes)
I have tried
<xsl:value-of select="count($nodeset/@PartnerArrivedAtCall
[@PartnerArrivedAtCall = 'Yes'])"/>
(returns zero)
and
<xsl:variable name="ArrivedYes"
select="$nodeset/@PartnerArrivedAtCall
[@PartnerArrivedAtCall='Yes']"/>
(also returns zero)
Can you please give me a good example of how to count only the true values (in my XML, true = "Yes")
Thanks开发者_如何学编程!
Try
count($nodeset[@PartnerArrivedAtCall = 'Yes'])
Why don't you use out of the box ddwrt
namespace functions to return list property: itemCount
http://msdn.microsoft.com/en-us/library/dd583143(v=office.11).aspx#officesharepointddwrt_listproperty
I have tried xsl:value-of select="count($nodeset/@PartnerArrivedAtCall[@PartnerArrivedAtCall = 'Yes')" (returns zero)
Yes, this is correct: an attribute cannot have attributes itself -- in the above you want to count PartnerArrivedAtCall
attributes whose PartnerArrivedAtCall
attribute has a specific value.
. .
and xsl:variable name="ArrivedYes" select= "$nodeset/@PartnerArrivedAtCall[@PartnerArrivedAtCall='Yes']"
(also returns zero)
This has exactly the same problem as the previous instruction.
Solution:
Use:
$nodeset/@PartnerArrivedAtCall[. ='Yes']
精彩评论