cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Curro, Joseph" <>
Subject RE: Best way to include ouitput of one page into another?
Date Wed, 22 Mar 2000 17:37:27 GMT
Doesn't this approach result in copying subelements of foo1.xml and foo2.xml
into the result tree, rather than the source tree?


-----Original Message-----
From: Michael French []
Sent: Wednesday, March 22, 2000 11:57 AM
To: ''
Subject: RE: Best way to include ouitput of one page into another?

> -----Original Message-----
> From: Rob Parker []
> Sent: Tuesday, March 21, 2000 3:03 PM
> To:
> Subject: Best way to include ouitput of one page into another?
> Hi I'm trying to include the output of one page into another. I've
> seen and tried a few ways with different levels of success.
> I've seen something like inclusion via DTD type declarations 
> (What is the syntax?)

This is a literal include, not an XML Include.
In fact it's a terrible hack !
For example, you cannot have an <?xml ..?> declaration 
in the target file, and to get the correct element
nesting, you even need to leave out the root element too.

<!DOCTYPE foo SYSTEM "foo.dtd" [  
   <!ENTITY include SYSTEM "foo.xml">


Note you have to have a root element in the including doc,
so you can't just do:

<!DOCTYPE foo SYSTEM "foo.dtd" [  
   <!ENTITY include SYSTEM "foo.xml">

There's also a neater way of doing this with XSLT document(),
which is a formal XML inclusion mechanism, and gives you 
flexibility over how the root elements are nested, 
e.g. for concatenating two similar documents:

  <xsl:template match="/">
      <xsl:copy-of select="document('foo1.xml')/foo/*"/>
      <xsl:copy-of select="document('foo2.xml')/foo/*"/>        

Of course you can make this more generic, but you quickly get into
technicalities with XPath, namespaces, <xsl:copy> of a root, etc. etc.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message