Project

Profile

Help

Question related to bug 1491444

Added by Anonymous almost 18 years ago

Legacy ID: #3765057 Legacy Poster: sk_olson (sk_olson)

I have an XSL using the "key" function, where the first argument is calculated using a "concat" function. The lookup is done against a separate XML file (via the "document" function). It has worked using Saxon 8.7.1 on multiple different input XML, but I've run into one that encounters the exact same NPE as bug 1491444. I tried the patch recommended in the bug posting, but it also fails. The relevant snippet in class KeyManager (line 428) looks like this: List definitions = getKeyDefinitions(fingerprint); if (definitions == null) { DynamicError de = new DynamicError("Key fingerprint " + fingerprint + " has not been defined"); de.setXPathContext(context); de.setErrorCode("XTDE1260"); throw de; } KeyDefinition definition = (KeyDefinition)definitions.get(0); I have modified the snippet from the bug post - Since the value of the "fingerprint" variable is -1, which is invalid, the original patch fails with a different exception as it tries to lookup the name that goes with the fingerprint value, and there is none. Is anyone familiar with this bug that could point me at how to diagnose why I'm getting an invalid fingerprint value of -1 while performing a key lookup? I believe the XML and XSL are ok, as I can process them in XMLSpy and the XSL works correctly. So I'm looking for help in diagnosing why 8.7.1 gets an NPE that is caused by this invalid fingerprint value. I can post the XSL, sample input XML, and a sample lookup XML document if it is helpful. Thanks in advance for any info.


Replies (1)

RE: Question related to bug 1491444 - Added by Anonymous almost 18 years ago

Legacy ID: #3773859 Legacy Poster: Michael Kay (mhkay)

Apologies for the delay in responding. For some reason SourceForge has stopped sending me notifications of forum posts. Oon inspecting the code, there does seem to be a remaining error that was either introduced by, or not fixed by, this patch (I haven't checked which). On line 200 of KeyFn.java, the code MappingFunction map = new MappingFunction() { // Map a value to the sequence of nodes having that value as a key value public Object map(Item item) throws XPathException { return keyManager.selectByKey( keyFingerprint, document, (AtomicValue)item, keyContext); } }; should read MappingFunction map = new MappingFunction() { // Map a value to the sequence of nodes having that value as a key value public Object map(Item item) throws XPathException { return keyManager.selectByKey( fprint, document, (AtomicValue)item, keyContext); } }; Let me know if this fixes the problem: otherwise, I'll need to see a test case that reproduces it. Michael Kay

    (1-1/1)

    Please register to reply