I can't get this count to return a number without an empty quote at the end ( " ) or getting NaN. Does anyone know why? I've searched and don't see any other postings on this issue. I'm using VS 2008. Thanks for any and all pointers!!!
XML file:
I've tried this several different ways in this sample XSL stylesheet:
Results:
Test_Count1: NaN
Test_Count2: 4"
Test_Count3: NaN
XML file:
Code:
<?xml version="1.0" encoding="utf-8"?> <CFF xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" FormCount="1" TotalFormCount="501" FileSubmitDate="2009-03-26"> <Form UFI="100082841" Address1="111 PENN AVENUE" City="PITTSBURGH" State="PA" Zip="15209"> <Individual UCI="900236487" FirstName="RACHEL"> <Income IncomeType="8" /> </Individual> <Individual UCI="900236488" FirstName="RUSSELL"> <Income IncomeType="8" /> </Individual> <Individual UCI="900236489" FirstName="REBECCA"> <Income IncomeType="8" /> </Individual> <Individual UCI="900236490" FirstName="MARY"> <Income IncomeType="8" /> </Individual> </Form> </CFF>
Code:
<?xml version="1.0"?> <!-- key.xsl --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:variable name="Test_Count1"> <xsl:number value="count(/CFF/Form/Individual/Income[@IncomeType='1' or @IncomeType='8'])" level="any" format="01"/>" </xsl:variable> <xsl:variable name="Test_Count2"> <xsl:number value="count(//CFF//Form//Individual/Income[@IncomeType=1 or @IncomeType=8]) "/>" </xsl:variable> <xsl:variable name="Test_Count3"> <xsl:value-of select="count(//CFF//Form//Individual/Income[@IncomeType=1 or @IncomeType=8]) "/>" </xsl:variable> <xsl:template match="/"> <html> <head> <title> <xsl:text>Count TEST </xsl:text> </title> </head> <body style="font-family: sans-serif;"> <xsl:call-template name ="TEST_VARIABLES"/> </body> </html> </xsl:template> <xsl:template name="TEST_VARIABLES"> <!-- TEST printing values to debug --> <p align="left"> Test_Count1: <xsl:value-of select="number($Test_Count1)"/> <br/> Test_Count2: <xsl:value-of select="$Test_Count2"/> <br/> Test_Count3: <xsl:number value="$Test_Count3"/> </p> </xsl:template> </xsl:stylesheet>
Test_Count1: NaN
Test_Count2: 4"
Test_Count3: NaN
Comment