This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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: 669
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,
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic