You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Olivier Richaud <ri...@cstb.fr> on 2000/07/19 14:40:27 UTC
OFF-TOPIC? Including an XML file in another one
I'm trying to define an xml page that is in fact an aggregation of several
other XML pages. What I want to do, is to consider those XML pages as XML
datasources that will be inserted in the top XML page. For example, my page
should look like:
<page>
<data-source src="ds1.xml"/>
<data-source src="ds2.xml"/>
</page>
The data-source tag points to another XML file that should be inserted. For
example, ine the ds1.xml file, I could find paragraphs:
<paragraph>
Foo bar, Foo bar,....
</paragraph>
Is there anyone with a solution for this? Anything which is Cocoon compliant
is welcome, that is using XSL, XSP, ....
Thanks in advance.
Olivier Richaud
CSTB
office: +33 4 93 95 67 24
mobile: +33 6 87 52 53 17
www: http://cic.cstb.fr
Re: OFF-TOPIC? Including an XML file in another one
Posted by Berin Loritsch <bl...@infoplanning.com>.
Olivier Richaud wrote:
>
> I'm trying to define an xml page that is in fact an aggregation of several
> other XML pages. What I want to do, is to consider those XML pages as XML
> datasources that will be inserted in the top XML page. For example, my page
> should look like:
>
> <page>
> <data-source src="ds1.xml"/>
> <data-source src="ds2.xml"/>
> </page>
>
> The data-source tag points to another XML file that should be inserted. For
> example, ine the ds1.xml file, I could find paragraphs:
>
> <paragraph>
> Foo bar, Foo bar,....
> </paragraph>
>
> Is there anyone with a solution for this? Anything which is Cocoon compliant
> is welcome, that is using XSL, XSP, ....
>
> Thanks in advance.
In your XSL file, call the external XML file with a construct like this:
<xsl:template match="page">
<xsl:for-each select="data-source">
<xsl:apply-templates select="document(data-source/@src)"/>
</xsl:for-each>
</xsl:template>
That should do it for you. If it complains about not finding the "@src",
then remove the preceding "data-source/". It's not clear to me if the
scope of the XPath statement automatically goes into "data-source/" when
you use the <xsl:for-each/> tag or not.
I have used the <xsl:apply-templates select="document(foo.xml)"/> construct
to keep menus separate from the content.
Re: OFF-TOPIC? Including an XML file in another one
Posted by Jeremy Quinn <je...@media.demon.co.uk>.
At 16:07 -0400 19/07/00, Donald Ball wrote:
>On Wed, 19 Jul 2000, Olivier Richaud wrote:
>
>> I'm trying to define an xml page that is in fact an aggregation of several
>> other XML pages. What I want to do, is to consider those XML pages as XML
>> datasources that will be inserted in the top XML page. For example, my page
>> should look like:
[snip]
>1. use xinclude processor
>2. use util:include-uri logicsheet
>3. use external entities
>4. use xslt document() function
5. use FP TagLib
--
___________________________________________________________________
Jeremy Quinn Karma Divers
webSpace Design
HyperMedia Research Centre
<ma...@mac.com> <http://www.media.demon.co.uk>
<phone:+44.[0].20.7737.6831> <pa...@sms.genie.co.uk>
Re: OFF-TOPIC? Including an XML file in another one
Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 19 Jul 2000, Olivier Richaud wrote:
> I'm trying to define an xml page that is in fact an aggregation of several
> other XML pages. What I want to do, is to consider those XML pages as XML
> datasources that will be inserted in the top XML page. For example, my page
> should look like:
>
> <page>
> <data-source src="ds1.xml"/>
> <data-source src="ds2.xml"/>
> </page>
>
> The data-source tag points to another XML file that should be inserted. For
> example, ine the ds1.xml file, I could find paragraphs:
>
> <paragraph>
> Foo bar, Foo bar,....
> </paragraph>
>
> Is there anyone with a solution for this? Anything which is Cocoon compliant
> is welcome, that is using XSL, XSP, ....
1. use xinclude processor
2. use util:include-uri logicsheet
3. use external entities
4. use xslt document() function
- donald