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.
Cannot convert #NUMBER to a NodeList - Xalan and the XPath function count()
posted 3 years ago
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?
No matter what they say in Ohio, we're still first in flight!