You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Katharina Kreis <ka...@web.de> on 2006/05/19 14:22:35 UTC
XInclude problem
Hi!
I have a problem with the xinclude transformer: When I call the
transformer in my sitemap I get the error message:
'A xml document must have a root element.' My result xml document has a
root element, so I think that the error is
perhaps another.
Here are my files:
Sitemap:
=========
<map:match pattern="pdf_bskonzept">
<map:generate type="Tamino" src="*[@ID={request-param:gid} or
@gebaeude_id={request-param:gid} or gebaeude_id={request-param:gid} or
//Gebaeude_ID={request-param:gid}]"/>
<map:transform type="xslt" src="styles/result.xsl"/>
<map:transform type="xslt" src="styles/include_gesetze.xsl">
<map:parameter name="gesetzeserver"
value="{global:gesetze-server}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
Inside the xslt file there is the xinclude command. The generator and
the transformer before are working!
The gesetzesserver parameter is: "http://localhost/tamino/Gesetze/Bau",
its an url to my xml database
include_gesetze.xsl:
====================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ino='http://namespaces.softwareag.com/tamino/response2'
xmlns:xql='http://metalab.unc.edu/xql/'
xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:param name="gesetzeserver"/>
<xsl:template match="tamino-result">
<tamino-result>
<xsl:copy-of select ="*" />
<data>
<xi:include>
<xsl:attribute name="href">
<xsl:value-of select="$gesetzeserver"/>
<xsl:text>?_XQL=Gesetze/Gesetz[@URI='hbo']/Bezeichnung</xsl:text>
</xsl:attribute>
</xi:include>
</data>
</tamino-result>
</xsl:template>
</xsl:stylesheet>
After this file I have the following xml in my pipeline:
-------------------------------------------------------
<?xml version="1.0"?>
<tamino-result>
...
<data>
<xi:include
href="http://localhost/tamino/Gesetze/Bau?_XQL=Gesetze/Gesetz[@URI='hbo']/Bezeichnung"></xi:include>
</data>
</tamino-result>
When I type the url
http://localhost/tamino/Gesetze/Bau?_XQL=Gesetze/Gesetz[@URI='hbo']/Bezeichnung
into my browser, I get the following:
---------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0"?>
<ino:response ...>
<xql:result>
<Bezeichnung>Hessische Bauordnung (HBO)</Bezeichnung>
</xql:result>
</ino:response>
The error comes directly after the line <map:transform
type="xinclude"/>. So what is wrong here? I have another pipeline with
such a xinclude command to my xml database
and it works!
Thanks for helping me!!!
Katharina
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: XInclude problem
Posted by Jason Johnston <co...@lojjic.net>.
> Hi!
>
> I have a problem with the xinclude transformer: When I call the
> transformer in my sitemap I get the error message:
> 'A xml document must have a root element.' My result xml document has a
> root element, so I think that the error is
> perhaps another.
> Here are my files:
>
> Sitemap:
> =========
> <map:match pattern="pdf_bskonzept">
> <map:generate type="Tamino" src="*[@ID={request-param:gid} or
> @gebaeude_id={request-param:gid} or gebaeude_id={request-param:gid} or
> //Gebaeude_ID={request-param:gid}]"/>
> <map:transform type="xslt" src="styles/result.xsl"/>
> <map:transform type="xslt" src="styles/include_gesetze.xsl">
> <map:parameter name="gesetzeserver"
> value="{global:gesetze-server}"/>
> </map:transform>
> <map:serialize type="xml"/>
> </map:match>
The XInclude transformer isn't being called in that snippet... I assume
that's just a copy-paste error, and that it comes right before the
map:serialize line.
>
> Inside the xslt file there is the xinclude command. The generator and
> the transformer before are working!
> The gesetzesserver parameter is: "http://localhost/tamino/Gesetze/Bau",
> its an url to my xml database
>
> include_gesetze.xsl:
> ====================
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
> xmlns:ino='http://namespaces.softwareag.com/tamino/response2'
>
> xmlns:xql='http://metalab.unc.edu/xql/'
>
> xmlns:xi="http://www.w3.org/2001/XInclude">
> <xsl:param name="gesetzeserver"/>
> <xsl:template match="tamino-result">
> <tamino-result>
> <xsl:copy-of select ="*" />
> <data>
> <xi:include>
> <xsl:attribute name="href">
> <xsl:value-of select="$gesetzeserver"/>
>
> <xsl:text>?_XQL=Gesetze/Gesetz[@URI='hbo']/Bezeichnung</xsl:text>
> </xsl:attribute>
> </xi:include>
> </data>
> </tamino-result>
> </xsl:template>
> </xsl:stylesheet>
>
> After this file I have the following xml in my pipeline:
> -------------------------------------------------------
> <?xml version="1.0"?>
> <tamino-result>
> ...
> <data>
> <xi:include
> href="http://localhost/tamino/Gesetze/Bau?_XQL=Gesetze/Gesetz[@URI='hbo']/Bezeichnung"></xi:include>
> </data>
> </tamino-result>
>
> When I type the url
> http://localhost/tamino/Gesetze/Bau?_XQL=Gesetze/Gesetz[@URI='hbo']/Bezeichnung
> into my browser, I get the following:
> ---------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0"?>
> <ino:response ...>
> <xql:result>
> <Bezeichnung>Hessische Bauordnung (HBO)</Bezeichnung>
> </xql:result>
> </ino:response>
One possible idea: the URL might need to have the special characters ([,
@, ], ', etc.) URL-encoded.
Do you have a way to verify that the request to your XML server is
actually being correctly executed... access logs or something? That would
tell you if the correct URL is being requested.
> The error comes directly after the line <map:transform
> type="xinclude"/>. So what is wrong here? I have another pipeline with
> such a xinclude command to my xml database
> and it works!
What are the differences between the one that works and the one that doesn't?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org