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]