This error suggests there is more than one NamePool around, probably because the DocumentBuilder used to build the document came from a different Processor than the one used to compile the stylesheet.

Saxon tries to stop this happening but doesn't always succeed. You haven't said which version of Saxon you are using. Each new version typically adds a couple of consistency checks in this area. The current version is 9.4.0.3.

Michael Kay
Saxonica



On 20/03/2012 13:55, Paul M wrote:
Hi:

Strange error occurring passing node as param

XSLT:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--   <xsl:param name="mysamplexml" as="element()" required="yes"/> -->
  <xsl:param name="mysamplexml" as="node()" required="yes"/>
  <xsl:variable name="header">
    <tr>      <th>Element</th>      <th>Description</th>    </tr>
  </xsl:variable>
  <xsl:template match="/">
    <mys>
      <xsl:copy-of select="$mysamplexml//*"/>
    </mys>
    <h>
      <xsl:copy-of select="$header//*"/>
    </h>
  </xsl:template>
</xsl:stylesheet>


JAVA:
    private static String exampleXML =
//                "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" +
                "<a>a3</a>";
            StringReader reader = new StringReader(exampleXML);
            XdmNode doc = builder.build(new StreamSource(reader));
            simpletrfm.setParameter(new QName("","mysamplexml"), doc);

I receive this exception:
java.lang.IllegalArgumentException: Unknown name code 1121
        at net.sf.saxon.om.NamePool.unknownNameCode(NamePool.java:834)
        at net.sf.saxon.om.NamePool.getDisplayName(NamePool.java:733)
        at net.sf.saxon.event.XMLEmitter.startElement(XMLEmitter.java:289)
        at net.sf.saxon.event.UncommittedSerializer.startElement(UncommittedSerializer.java:149)
        at net.sf.saxon.event.NamespaceReducer.startElement(NamespaceReducer.java:72)
        at net.sf.saxon.event.ComplexContentOutputter.startContent(ComplexContentOutputter.java:531)
...

I know mysamplexml is passed as a document node, so not sure if I should pass it differently as well?

-Paul