From: Joe W. <jo...@gm...> - 2010-07-08 22:02:13
|
Hi Dmitriy, Just an update to let you know that I tested my example with 1.5dev rev. 11881 (from last week), and I got the same error (see my exist.log attached to my 1st e-mail in this thread). So I tried switching from Xalan to Saxon 9.1.0.7 (the version suggested by Ron), and I switched my stylesheet to the XSLT 2.0 version of the same stylesheet (/db/stylesheet/xhtml2/tei.xsl), and I got a very similar set of errors from Saxon as Xalan. This suggests the problem isn't in Xalan or Saxon, but rather with the Transform.java's Database Resolver. I also found a lot more clues in the exist.log this time! Maybe these will help troubleshoot? I think a solution isn't far away! Here's what I see: 1. Saxon starts up and gets the right base path: 2010-07-08 17:44:24,996 [qtp181871104-23] DEBUG (TransformerFactoryAllocator.java [getTransformerFactory]:103) - Set transformer factory: net.sf.saxon.TransformerFactoryImpl 2010-07-08 17:44:24,997 [qtp181871104-23] DEBUG (Transform.java [<init>]:597) - Database Resolver base path set to /db/test/stylesheet/xhtml2 2. We serialize the stylesheet to Saxon: 2010-07-08 17:44:25,032 [qtp181871104-23] DEBUG (NativeSerializer.java [serializeToReceiver]:107) - serializing document 25727 (/db/test/stylesheet/xhtml2/tei.xsl) to SAX took 20 3. The includes/imports begin, and they're actually resolved to the correct path: 2010-07-08 17:44:25,056 [qtp181871104-23] DEBUG (Transform.java [resolve]:661) - Resolving database path ../common2/tei.xsl with base to /db/test/stylesheet/common2/tei.xsl (URI = /db/test/stylesheet/common2/tei.xsl) 2010-07-08 17:44:25,075 [qtp181871104-23] DEBUG (Transform.java [resolve]:661) - Resolving database path tei-param.xsl with base /db/test/stylesheet/common2/tei.xsl to /db/test/stylesheet/common2/tei-param.xsl (URI = /db/test/stylesheet/common2/tei-param.xsl) 4. These continue until all apparently all of the includes finish, and then we see the XML source being serialized to Saxon. But an error happens: 2010-07-08 17:44:27,215 [qtp181871104-23] DEBUG (NativeSerializer.java [serializeToReceiver]:107) - serializing document 23857 (/db/test/index.xml) to SAX took 8 2010-07-08 17:44:27,230 [qtp181871104-23] DEBUG (Transform.java [resolve]:661) - Resolving database path with base /db/test/stylesheet/common2/i18n.xsl to /db/test/stylesheet/common2/ (URI = /db/test/stylesheet/common2) 2010-07-08 17:44:27,232 [qtp181871104-23] DEBUG (Collection.java [getDocument]:532) - Document common2 not found! 2010-07-08 17:44:27,232 [qtp181871104-23] DEBUG (NativeBroker.java [getXMLResource]:1762) - document '/db/test/stylesheet/common2' not found! 2010-07-08 17:44:27,232 [qtp181871104-23] DEBUG (Transform.java [resolve]:669) - Document /db/test/stylesheet/common2/ not found 2010-07-08 17:44:27,233 [qtp181871104-23] WARN (Transform.java [error]:719) - XSL transform reports recoverable error: Exception thrown by URIResolver ; SystemID: /db/test/stylesheet/common2/figures.xsl; Line#: 1048575; Column#: -1 net.sf.saxon.trans.XPathException: Exception thrown by URIResolver at net.sf.saxon.functions.Document.makeDoc(Document.java:348) at net.sf.saxon.functions.Document$DocumentMappingFunction.map(Document.java:224) ... Clearly, it's making a mistake with: "Resolving database path with base /db/test/stylesheet/common2/i18n.xsl to /db/test/stylesheet/common2/". It should resolve the database path to "common2/i18n.xsl", not to "common2/". In other words, the filename is getting truncated from the path. Does this give you any hints? One more hint: I managed to get this to work, but it's very hackish. What I did was (1) put another copy of /db/test/stylesheet/common/i18n.xsl into the database at /db/test/i18n.xsl, and (2) I renamed this file to "common2". Then (3) I put a copy of /db/test/stylesheet/i18n.xml into /db/test/i18n.xml. With these changes, eXist successfully applied the XSLT to the source XML file. This is a terrible workaround, but I mention it in case it helps. It looks to me like a solution isn't *that* far off! Thanks, Joe On Thu, Jul 8, 2010 at 1:28 PM, Dmitriy Shabanov <sha...@gm...>wrote: > On Thu, 2010-07-08 at 13:18 -0400, Joe Wicentowski wrote: > > Hi Dmitriy, > > > > >> Do you or does anyone know of a way to pass transform:transform() a > > >> parameter which could be used to specify the base path? > > > > > > The base path is the first xsl file location. I did have some trouble > > > with docbook some time ago (urls like "../something") and did fix it at > > > the trunk. > > > > Thanks, this is helpful to know. > > > > Would this fix include the case where there are multiple includes - > > e.g. where the first xsl (1.xsl) includes "../common/2.xsl", which in > > turn includes "3.xsl", which is relative to 2.xsl? > > Yes, I have exactly this problem @docbook. > > > Also, do you know by chance if your fix is in the 1.4.0 release, or if > > not, if it has been ported from trunk back to the 1.4.x-stable? > > No, I'll do as soon as get time. (the changes is simple, need to find it > after all :-) > > -- > Cheers, > > Dmitriy Shabanov > |