atom feed2 messages in net.sourceforge.lists.saxon-helpRe: [saxon] Namepool issue?
FromSent OnAttachments
thun...@hotmail.comJun 27, 2007 12:36 pm 
Michael KayJun 28, 2007 9:04 am 
Subject:Re: [saxon] Namepool issue?
From:Michael Kay (mi@saxonica.com)
Date:Jun 28, 2007 9:04:21 am
List:net.sourceforge.lists.saxon-help

Saxon has changed at some stage so that instead of everyone using the same (static) NamePool by default, the default is that each Configuration uses its own NamePool. I suspect that what's happening here is that your extension function is creating the document under a different Configuration and therefore a different NamePool. Saxon detects this and reports an error in most cases, but I suspect that it's not detecting it in the case of documents introduced to the system as the result of an extension function.

The rule is that all documents used in a given application should use the same Configuration. To achieve this you'll need to pass a context parameter to your extension function, and extract the Configuration from this.

-----Original Message----- From: saxo@lists.sourceforge.net [mailto:saxo@lists.sourceforge.net] On Behalf Of thun@hotmail.com Sent: 27 June 2007 20:37 To: saxo@lists.sourceforge.net Subject: [saxon] Namepool issue?

I am in the process of upgrading from Saxon 8-1-1B to Saxon 8-9B. The following issue occurs in Saxon 8-9B and SaxonSA 8-9-0-3j.

I have a java function with the following signature that is called from an XSL stylesheet that worked fine with Saxon 8-1-1:

public static javax.xml.transform.Source execute(String serviceName)

We use this method to retrieve some data in XML from a database. The result is stored in a variable and accessed later in the transform.

<xsl:function name="fcfn:shiftDropDown-getCurrentBOWTimeFrames"> <xsl:variable name="result" select="ServiceHelper:execute('GetTimeFramesForBillOfWork')"/> <xsl:copy-of select="$result"/> </xsl:function>

If I inspect the $result variable inside of the function, the returned nodes look perfectly fine.

If I inspect the return value of the function, the nodes have element name replaced with name of other elements, attributes replaced with names of other nodes, etc.

<timeFrame timeFrameId="BoTfId102"> <timeFrameNumber>1</timeFrameNumber> <startDateTime>06/22/2007 06:00</startDateTime> <endDateTime>06/22/2007 14:00</endDateTime> <billOfWorkDay dayNumber="1"/> <timeFrameDefinition timeFrameDefinitionId="timeFrameDefinitionId2"> <name>1</name> <startOffsetMinutes>360</startOffsetMinutes> <durationMinutes>480</durationMinutes> <effectiveStartDateTime>05/31/2005 19:00</effectiveStartDateTime> <timeFrameType timeFrameTypeId="timeFrameTypeId1"> <name>Shifts</name> <typeIdentifier>SHIFTS</typeIdentifier> </timeFrameType> </timeFrameDefinition> <workingTimeFrameNumber>1</workingTimeFrameNumber> <dayNumber>1</dayNumber> <current>false</current> <startDateTimeISO>2007-06-22T06:00:00-05:00</startDateTimeISO> <endDateTimeISO>2007-06-22T14:00:00-05:00</endDateTimeISO> </timeFrame>

Becomes:

<timeFrame Configuration.name_taskCardDetailEntryDuringNonroutineEval="Bo TfId102"> <timeFrameNumber>1</timeFrameNumber> <startDateTime>06/22/2007 06:00</startDateTime> <getConfigurationValue>06/22/2007 14:00</getConfigurationValue> <billOfWorkDay taskBuybackRequirementsRadio="1"/> <timeFrameDefinition DD="timeFrameDefinitionId2"> <name>1</name> <startOffsetMinutes>360</startOffsetMinutes> <companyOperator>480</companyOperator> <effectiveStartDateTime>05/31/2005 19:00</effectiveStartDateTime> <noPageHeight DomainAction.START="timeFrameTypeId1"> <name>Shifts</name> <typeIdentifier>SHIFTS</typeIdentifier> </noPageHeight> </timeFrameDefinition> <action>1</action> <taskBuybackRequirementsRadio>1</taskBuybackRequirementsRadio> <current>false</current> <skillAssignments>2007-06-22T06:00:00-05:00</skillAssignments>

<DomainAction.TALLY_TASKCARD_MATERIAL>2007-06-22T14:00:00-05:0 0</DomainAction.TALLY_TASKCARD_MATERIAL> </timeFrame>

The data inside the elements and attributes is fine, but the names have been mangled. I imagine that the namepool is getting confused.

I think it may be related to the <xsl:copy-of/> because this same code called on a page with less imported stylesheets results in the following exception. I've cropped the rest of the exception.

java.lang.IllegalArgumentException: Unknown name code 1560

net.sf.saxon.om.NamePool.unknownNameCode(NamePool.java:804)

net.sf.saxon.om.NamePool.allocateNamespaceCode(NamePool.java:607)

net.sf.saxon.event.NamespaceReducer.startElement(NamespaceRedu cer.java:85)

net.sf.saxon.event.ComplexContentOutputter.startContent(Comple xContentOutputter.java:491)

net.sf.saxon.event.SequenceWriter.startContent(SequenceWriter. java:204)

net.sf.saxon.event.ProxyReceiver.startContent(ProxyReceiver.java:163) net.sf.saxon.om.Navigator.copy(Navigator.java:547) net.sf.saxon.jdom.NodeWrapper.copy(NodeWrapper.java:779) net.sf.saxon.om.Navigator.copy(Navigator.java:557) net.sf.saxon.jdom.NodeWrapper.copy(NodeWrapper.java:779) net.sf.saxon.om.Navigator.copy(Navigator.java:557) net.sf.saxon.jdom.NodeWrapper.copy(NodeWrapper.java:779) net.sf.saxon.om.Navigator.copy(Navigator.java:557) net.sf.saxon.jdom.NodeWrapper.copy(NodeWrapper.java:779) net.sf.saxon.om.Navigator.copy(Navigator.java:557) net.sf.saxon.jdom.NodeWrapper.copy(NodeWrapper.java:779) net.sf.saxon.om.Navigator.copy(Navigator.java:517) net.sf.saxon.jdom.NodeWrapper.copy(NodeWrapper.java:779)

net.sf.saxon.instruct.CopyOf.processLeavingTail(CopyOf.java:223)

net.sf.saxon.instruct.Instruction.process(Instruction.java:91) net.sf.saxon.instruct.CopyOf.iterate(CopyOf.java:469) net.sf.saxon.value.Closure.iterate(Closure.java:192) net.sf.saxon.value.Value.getIterator(Value.java:214)

Any idea on how I can resolve this?

Thank you,

Matt Miller

--------------------------------------------------------------