Hi folks, I just found how to make my problem go away... I had had the gem sitemap configured to match the URI "*/*/framework/" and thus dispatch my framework.xsl stylesheet. Now I changed that to "*/*/framework", i.e. removed the trailing "/", and now it works (the document() function is finding the XML file ../resources/gem-data.xml).
Weird! I'm still trying to figure out what that means. Any pointers? Does it mean Xalan is a nonconformant XSL processor? Or would someone claim it's correct for the document() function to base its URI on the request URI?? Thanks, Lars > -----Original Message----- > From: Lars Huttar [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 16, 2003 3:26 PM > To: Cocoon Users List (E-mail) > Subject: problem with relative URI in document() in XSLT in Cocoon > > > Hi all, > I am trying to access an auxiliary XML document from an XSLT > stylesheet, > using the document() function, within a Cocoon pipeline. E.g. > <xsl:template match="/dir:directory"> > <xsl:value-of > select="count(document('../resources/gem-data.xml'))" /> > ... > > The XSLT Programmer's Ref. (Kay) says that relative URI there > should be > resolved relative to the directory where the stylesheet is located > (since the string argument to document() comes from the stylesheet, > not from the source file). > > Does that hold true in Cocoon? I would think so, but... > > In the above example, the count() expression is returning zero. > The stylesheet is cocoon/gem/transforms/framework.xsl, while > the XML document is cocoon/gem/resources/gem-data.xml. > > I ran the same stylesheet from outside of Cocoon, using Saxon, > and the count() expression returned 1! > (using gem/resources/testdir.xml as input.) > (I tried this both from the cocoon/gem/transforms directory, > and from the cocoon/gem directory, in case it mattered.) > So it sounds like the stylesheet is misbehaving within Cocoon. > > As an additional test, I ran this simpler stylesheet both > within and outside cocoon: > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:gem="http://www.sil.org/namespace/gem"> > <xsl:template match="/"> > <xsl:value-of > select="count(document('../resources/gem-data.xml'))" /> > </xsl:template> > </xsl:stylesheet> > > And in this case, count() returned 1 both within Cocoon and > outside it! > This simpler stylesheet, test-docmt.xsl, was also located in > cocoon/gem/transforms. > > So this simpler stylesheet behaves correctly inside and > outside of Cocoon! > So I'm confused. > > I'm using Cocoon 2.1.2. > > I've put the aforementioned files (and the cocoon/ and gem/ > sitemaps) at > http://www.huttar.net/lars-kathy/test/cocoon/gem/... > in case anyone is kind enough to look at them. > > Thanks, > > Lars > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
