aspose file tools*
The moose likes XML and Related Technologies and the fly likes Cannot convert #NUMBER to a NodeList - Xalan and the XPath function count() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Cannot convert #NUMBER to a NodeList - Xalan and the XPath function count()" Watch "Cannot convert #NUMBER to a NodeList - Xalan and the XPath function count()" New topic
Author

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

David Brossard
Ranch Hand

Joined: Jun 03, 2004
Posts: 109
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.


No matter what they say in Ohio, we're still first in flight!
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 547
    
    3
I don't think there is such thing in xslt/xpath
<xsl:value-of select="count(/**/xacml3:Rule[@Effect='Deny'])" />

write instead this,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot convert #NUMBER to a NodeList - Xalan and the XPath function count()