new to this site. Hoping someone can help me figure out why my code is not working. I used some other posts on the subject from this site to get this close, but can't see my error.
<!-- Keyset based on the Subject (Part Number) --> <xsl:key name="key_PartNumber" match="Subject" use="."/> <xsl:template match="/"> <BOM> <!-- Do for each unique Subject (Part Number) --> <xsl:for-each select="//Markup/Subject[generate-id() = generate-id(key('key_PartNumber', .))]"> <Part> <xsl:attribute name="Part_Number"> <xsl:value-of select="."/> </xsl:attribute> <xsl:attribute name="Count"> <xsl:value-of select="count(//Markup[Subject=.])"/> </xsl:attribute> </Part> </xsl:for-each> </BOM> </xsl:template> </xsl:stylesheet>
When I run my transform, I always get counts of 0. Below is a screenshot of both the sample xml file, as well as the result of an xpath query that are getting the correct result. SAMPLE XML with XPATH Result