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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to