Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot convert #NUMBER to a NodeList - Xalan and the XPath function count()

 
David Brossard
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to count the occurrences of an Element based on the value of one its attributes. I have written the XSLT displayed below and tested it in an online XSLT tester and it works so far.

When I write my own Java code, though, I keep getting an error that Cannot convert #NUMBER to a NodeList. I cannot find a good answer though.

Here is my XSLT:



And here is how I invoke the transformation


In the above code I iterate over a list of files and apply the XSLT to get the count of it and save it inside an XML SVG File as per the XSLT transformation which goes to a string (via a ByteArrayOutputStream). However even before I reach that point, I get the exception I mentioned at the top.

So what's the issue?

Thanks,
D.
 
g tsuji
Ranch Hand
Posts: 666
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is such thing in xslt/xpath
<xsl:value-of select="count(/**/xacml3:Rule[@Effect='Deny'])" />

write instead this,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic