I've got something that does your inclusion, but don't ask my why you have
to do it this way :) !
I did it with xinclude, because document() returns nothing.
And if anyone knows another or a better way to do it, I'm very interested in
it :) !
(still haven't found out how cocoon does his stuff...)
Olivier
----------------------------------
A.xsl
----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://www.apache.org/1999/XSP/Core"
xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
>
<!-- this PI does *nothing* ! -->
<?cocoon-process type="xinclude"?>
<!-- When I comment this line I have no problems at all -->
<xsl:include href="C.xsl" />
<xsl:template match="/">
<!-- this PI does the inclusion -->
<xsl:processing-instruction
name="cocoon-process">type="xinclude"</xsl:processing-instruction>
<html>
xinclude:
<include xinclude:href="B.xml#xpointer(//nombre)" xinclude:parse="xml"
/>
document:
<!-- not processed... dunno why -->
<xsl:value-of select="document('B.xml')//nombre" />
apply-templates:
<xsl:apply-templates/>
</html>
</xsl:template>
</xsl:stylesheet>
----------------------------------
C.xsl
----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
<!-- Even if it does nothing I get the problem -->
<xsl:template match="nothing">
<foo>
foo
</foo>
</xsl:template>
</xsl:stylesheet>
> -----Message d'origine-----
> De : Ruben [mailto:[EMAIL PROTECTED]]
> Envoyé : mercredi 20 juin 2001 21:55
> À : [EMAIL PROTECTED]
> Objet : namespaces, document() and include
>
>
>
> Hi everybody!
>
> I have found a very strange behaviour using XSL under Tomcat with
> Cocoon (in Linux) when I mix namespaces and includes.
>
> Suppose I have 4 documents:
>
> a) A.xml -> procesed by A.xsl
> b) A.xsl -> processes A.xml, acceses B.xml with 'document()' and
> includes C.xsl
> c) B.xml -> with some data I want to retrieve from A.xsl. Uses
> xsp:namespace
> d) C.xsl -> with some functions used by A.xsl
>
> The problem: when (and only when) I include C.xsl inside
> A.xsl I cannot
>
> access the data in B.xml; I get the error: 'cannot load
> requested doc'.
> I've tried to reduce the files to the minimum, but I still
> have the same
>
> problem.
>
> Here you have the reduced examples of the files:
>
> A.xml
> ---------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet type="text/xsl" href="/xsl/A.xsl"?>
>
> <nothing>
> </nothing>
> ---------------------------------------
>
> A.xsl
> ---------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>
> <!-- When I comment this line I have no problems at all -->
> <xsl:include href="C.xsl" />
>
> <xsl:template match="/">
> <html>
> <xsl:value-of select="document('B.xml')//nombre" />
> </html>
> </xsl:template>
>
>
> </xsl:stylesheet>
> ---------------------------------------
>
>
> B.xml
> ---------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet type="text/xsl" href="D.xsl"?>
>
> <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> xmlns:accesoBD="http://www.e-inteligentia.com/accesoBD">
>
> <nombre>the data I want to retrieve</nombre>
>
> </xsp:page>
>
> ---------------------------------------
>
>
> C.xsl
> ---------------------------------------
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
>
> <!-- Even if it does nothing I get the problem -->
> </xsl:stylesheet>
> ---------------------------------------
>
> What am I doing wrong? Have I forgotten to declare a namespace or
> something? Is it a Cocoon problem? I would really appreciate any help,
> thank you in advance...
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>