You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Koch <ko...@pixelpark.com> on 2002/09/30 14:24:54 UTC
XInclude generated by XSL
Hi,
I want to add an xi:include element by XSLT and then use the xinclude
transformer to include the referenced XML. So I tried this:
<map:match pattern="article">
<map:generate src="xml/article.xml"/>
<map:transform src="xsl/include/add-navigation.xsl"/>
<map:transform type="xinclude"/>
<map:serialize type="xml"/>
</map:match>
with add-navigation.xsl:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xsl:template match="/*">
<xsl:copy>
<xsl:copy-of select="@* | *"/>
<xi:include href="included.xml"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Unfortunately I get an empty file.
So I tried to split.
<map:match pattern="article">
<map:generate src="xml/article.xml"/>
<map:transform src="xsl/include/add-navigation.xsl"/>
<map:serialize type="xml"/>
</map:match>
which adds the xi:include element. The result is something like
<foo>
<bar/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="included.xml"/>
</foo>
When I save this as 'article1.xml' and change the pipeline to
<map:match pattern="article">
<map:generate src="xml/article1.xml"/>
<map:transform type="xinclude"/>
<map:serialize type="xml"/>
</map:match>
I get
<foo>
<bar/>
<included_element xmlns:xi="http://www.w3.org/2001/XInclude"/>
</foo>
as intended.
--
Johannes Koch . IT Developer
Pixelpark AG . http://www.pixelpark.com
Rotherstraße 8 . 10245 Berlin . Germany
phone: +49 30 5058 - 1288 . fax: - 1355
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: XInclude generated by XSL
Posted by Johannes Koch <ko...@pixelpark.com>.
Michael Wechner wrote:
> Do you use XInclude or CInclude?
XInclude.
> Did you ever try with
> <xi:include xml:base="cocoon:" href="included.xml"/>
> ?
No, not yet.
> Although you then need "another" pipeline to generate included.xml.
>
> Although your original version should work principally.
Yes, I hoped so :-|
--
Johannes Koch . IT Developer
Pixelpark AG . http://www.pixelpark.com
Rotherstraße 8 . 10245 Berlin . Germany
phone: +49 30 5058 - 1288 . fax: - 1355
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: XInclude generated by XSL
Posted by Michael Wechner <mi...@wyona.org>.
Do you use XInclude or CInclude?
Did you ever try with
<xi:include xml:base="cocoon:" href="included.xml"/>
? Although you then need "another" pipeline to generate included.xml.
Although your original version should work principally.
HTH
Michael
Johannes Koch wrote:
> Hi,
>
> I want to add an xi:include element by XSLT and then use the xinclude
> transformer to include the referenced XML. So I tried this:
>
> <map:match pattern="article">
> <map:generate src="xml/article.xml"/>
> <map:transform src="xsl/include/add-navigation.xsl"/>
> <map:transform type="xinclude"/>
> <map:serialize type="xml"/>
> </map:match>
>
> with add-navigation.xsl:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:xi="http://www.w3.org/2001/XInclude">
>
> <xsl:template match="/*">
> <xsl:copy>
> <xsl:copy-of select="@* | *"/>
> <xi:include href="included.xml"/>
> </xsl:copy>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Unfortunately I get an empty file.
>
> So I tried to split.
>
> <map:match pattern="article">
> <map:generate src="xml/article.xml"/>
> <map:transform src="xsl/include/add-navigation.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
>
> which adds the xi:include element. The result is something like
>
> <foo>
> <bar/>
> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
> href="included.xml"/>
> </foo>
>
> When I save this as 'article1.xml' and change the pipeline to
>
> <map:match pattern="article">
> <map:generate src="xml/article1.xml"/>
> <map:transform type="xinclude"/>
> <map:serialize type="xml"/>
> </map:match>
>
> I get
>
> <foo>
> <bar/>
> <included_element xmlns:xi="http://www.w3.org/2001/XInclude"/>
> </foo>
>
> as intended.
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>