I can't reproduce this using any recent version of Saxon 6.x, and the line numbers in GeneralOutputter are about 20 lines adrift from the current version (6.5.5). Which version are you using?
 
Can you reproduce it when running from the command line?
 
Michael Kay
http://www.saxonica.com/


From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Aarts, Marco
Sent: 20 December 2005 10:45
To: saxon-help@lists.sourceforge.net
Subject: [saxon] copy, namespace prefix and namepool

Dear all,
 
I am trying to do a simple copy of an xml document, using xslt 1. Other processors do the job just fine, but with Saxon I get NamePool exceptions when I change the values of namespace uri's or their prefixes in the original document.
 
The source document contains a default namespace, plus several namespaces defined on sub-elements.
 
My guess is that namespace prefixes are somehow cached over several transformations.
 
Stylesheet, sample and error message are included. I'm using Sonic Stylus Studio, but have also seen the error occur in our Sonic ESB server.
 
Can someone explain what's going on?
 
kind regards,
Marco Aarts
 
(example: source document that works)
<?xml version="1.0" encoding="UTF-8" ?>
<Antwoord xmlns="http://www.test.nl/antwoord/1.0">
<Verwijzingen>
<Verwijzing>
 <ns123:CodeSysteem xmlns:ns123="http://www.test.nl/verwijzing/1.0">test</ns123:CodeSysteem>
 </Verwijzing>
<Verwijzing>
<ns130:CodeSysteem xmlns:ns130="http://www.test.nl/verwijzing/1.0">test</ns130:CodeSysteem>
 </Verwijzing>
 </Verwijzingen>
 </Antwoord>
 
(example: source document that does not work - changed the namespace URI)
<?xml version="1.0" encoding="UTF-8" ?>
<Antwoord xmlns="http://www.test.nl/antwoord/1.0">
<Verwijzingen>
<Verwijzing>
 <ns123:CodeSysteem xmlns:ns123="http://www.test2.nl/verwijzing/1.0">test</ns123:CodeSysteem>
 </Verwijzing>
<Verwijzing>
<ns130:CodeSysteem xmlns:ns130="http://www.test2.nl/verwijzing/1.0">test</ns130:CodeSysteem>
 </Verwijzing>
 </Verwijzingen>
 </Antwoord>
 
(the stylesheet)
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="@*|node()" mode="copy">
  <xsl:copy>
   <xsl:copy-of select="@*"/>
   <xsl:apply-templates mode="copy"/>
  </xsl:copy>
 </xsl:template>
 <xsl:template match="/">
  <xsl:apply-templates select="*" mode="copy"/>
 </xsl:template>
</xsl:stylesheet>
 
(the exception)
java.lang.RuntimeException
java.lang.NullPointerException
 at com.icl.saxon.om.NamePool.allocateCodeForPrefix(NamePool.java:336)
 at com.icl.saxon.om.NamePool.allocateNamespaceCode(NamePool.java:492)
 at com.icl.saxon.output.NamespaceEmitter.startElement(NamespaceEmitter.java:68)
 at com.icl.saxon.output.GeneralOutputter.flushStartTag(GeneralOutputter.java:727)
 at com.icl.saxon.output.GeneralOutputter.writeContent(GeneralOutputter.java:442)
 at com.icl.saxon.output.GeneralOutputter.writeContent(GeneralOutputter.java:425)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:89)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.Controller.run(Controller.java:178)
 at com.icl.saxon.Controller.transformDocument(Controller.java:1079)
 at com.icl.saxon.Controller.transform(Controller.java:946)
 at com.exln.stylus.CSaxonDriver.doProcessing(CSaxonDriver.java:143)
 at com.exln.stylus.CProcessorDriver.process(CProcessorDriver.java:55)
 
Disclaimer

Dit bericht met eventuele bijlagen is vertrouwelijk en uitsluitend bestemd voor de geadresseerde. Indien u niet de bedoelde ontvanger bent, wordt u verzocht de afzender te waarschuwen en dit bericht met eventuele bijlagen direct te verwijderen en/of te vernietigen. Het is niet toegestaan dit bericht en eventuele bijlagen te vermenigvuldigen, door te sturen, openbaar te maken, op te slaan of op andere wijze te gebruiken. Ordina N.V. en/of haar groepsmaatschappijen accepteren geen verantwoordelijkheid of aansprakelijkheid voor schade die voortvloeit uit de inhoud en/of de verzending van dit bericht.

This e-mail and any attachments are confidential and is solely intended for the addressee only. If you are not the intended recipient, please notify the sender and delete and/or destroy this message and any attachments immediately. It is prohibited to copy, to distribute, to disclose or to use this e-mail and any attachments in any other way. Ordina N.V. and/or its group companies do not accept any responsibility nor liability for any damage resulting from the content of and/or the transmission of this message.