I have a SP Dataview that I have converted to XSLT, so that I could add a header displaying a percentage (Complete).
Before I converted the dvwp to xslt, I added two count headers- one on Complete, and another on LastName. They worked wonderfully- showing me the # of records and the # of records with a value in the complete field. However, when I converted the dv to xslt I realized that I lost my headers :(
So, I am adding them back in using xslt. Currently the XPath code for the equation that I have is <xsl:value-of select="count($Rows) div count($Rows)" />
.
How do I get the total # of Yes values that are in my Complete field?
UPDATE1:
Found this http://www.endusersharepoint.com/STP/viewtopic.php?f=14&t=534 and tried it, however causes the following error- Failed setting processor stylesheet: 0x80004005: Argument 1 must return a node-set. -->count(/dsQueryResponse/Rows/Row= Y )<--
UPDATE2:
Complete is the name of a field w/i my XSLT dataset. The return type is either Y or blank. For grins I tried <xsl:value-of select="count(/xpath/to/parent/element[@Complete eq Y ]) div count($Rows)" />
however I recieved the following error- Failed setting processor stylesheet: 0x80004005: Expected token ] found NAME .count((/xpath/to/parent/element[@Complete -->eq <-- Y ]) div count($Rows) Am starting to think that there may be a problem w/ eq .... Referencing my XML operators...
UPDATE3:
<xsl:value-of select="count(/xpath/to/parent/element[@Complete = Y ]) div count($Rows)" />
因此,“奥凯”仍然说零,但我认为,它为什么不展示正确的答案,是b)它期望显示一种愤怒,而且从这一公式中收回的价值显然会是一种弊端。 曾与我所尝试的那段话的XPath的公式相交
count(/xpath/to/parent/element[@Complete = Y ]) div count($Rows)*100
(count(/xpath/to/parent/element[@Complete = Y ]) div count($Rows))*100
100(count(/xpath/to/parent/element[@Complete = Y ]) div count($Rows))
UPDATE4:
So I know my previous thought that the correct number not showing b/c it was a float is not correct, as all numbers in XPath and XSLT 1.0 are floats. Reference
UPDATE5:
Upon further investigation, I have found that the problem lies with the count(/xpath/to/parent/element[@Complete = Y ])
part of my equation, as this is returning 0 instead of a value. [i know i have at least 3 Y vals in my Complete col]
<>><>>>>>>>
<records*>
<record*>
<last_name></last_name>
<first_name></first_name>
<mi></mi>
<office_symbol></office_symbol>
<geo_location></geo_location>
<complete></complete>
<date_complete></date_complete>
<date_expires></date_expires>
<email></email>
<supervisor></supervior>
</record*>
</records*>
*i don t know what these nodes are called as my data is coming from a database and not an xml file, i just made up record/records
UPDATE7
Going back to my original question. I am still trying to find out the XPath equation to display the number of parents (record in the XML i posted above) where the complete node = Y.
UPDATE8
Ok. So I have edited and tested using http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=tryxsl_value-of. Working XSLT to count the # of Complete = Y is <xsl:value-of select="count(catalog/cd [complete = Y ])" />
so theen I put EXACTLY what works on W3schools into my SP Dataview and I get nothing... just an empty space. Why doesn t the code work in my SPDV?