You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Berin Loritsch <bl...@infoplanning.com> on 2000/09/25 20:55:24 UTC

Including external XML without XSP

I have a need to include an external XML file (menu.xml) in order
to have the same menu for the entire site.

The format of the menu.xml file is like this:
---------------------------------------------------------
<?xml version="1.0"?>

<!DOCTYPE menu [
<!ELEMENT menu (item|group)*>
<!ELEMENT group (item)*>
<!ATTLIST group link  CDATA #REQUIRED
                title CDATA #REQUIRED>
<!ELEMENT item EMPTY>
<!ATTLIST item link  CDATA #REQUIRED
               title CDATA #REQUIRED>
]>

<menu>
  <item link="/about.xml" title="about us"/>
  <group link="/content.xml" title="business solutions">
    <item link="/retail.xml" title="retail systems"/>
    <item link="/testing.xml" title="testing"/>
  </group>
  <item link="/contactus.xml" title="contact us"/>
</menu>
---------------------------------------------------------

The problem with using XSLT is that when I do this:
<xsl:apply-templates select="document('menu.xml')"/>
the only elements it grabs are menu and item.  It ignores
group and everything inside of it.

I employed XSP with the <util:include-file name="menu.xml"/>
taglib call which works properly, but effectively doubles or
triples the time it takes to respond to the request.

I want to know if I can include another file with all subelements
without using XSP.

---------------------------------------------------------
If you lust for Ham and Eggs, you have
committed breakfast in your heart
already.   -- C. S. Lewis


Re: Including external XML without XSP

Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message ----- 
From: "Uli Mayring" <ul...@denic.de>
To: <co...@xml.apache.org>
Sent: Monday, September 25, 2000 3:26 PM
Subject: Re: Including external XML without XSP


> On Mon, 25 Sep 2000, Berin Loritsch wrote:
> 
> > > Use the XInclude processor.
> > >
> > > Ulrich
> > 
> > I can't find any docs, how does it work?
> 
> You should download a new snapshot then, probably something went wrong
> with your last download, because the docs are definitely there. Just do a
> grep for xinclude.
> 
> Ulrich

Got it!  It works great (I love the cache doing the work for me!).
I used the sample code and derived it from there.

---------------------------------------------------------
If you lust for Ham and Eggs, you have
committed breakfast in your heart
already.   -- C. S. Lewis



Re: Including external XML without XSP

Posted by Uli Mayring <ul...@denic.de>.
On Mon, 25 Sep 2000, Berin Loritsch wrote:

> > Use the XInclude processor.
> >
> > Ulrich
> 
> I can't find any docs, how does it work?

You should download a new snapshot then, probably something went wrong
with your last download, because the docs are definitely there. Just do a
grep for xinclude.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Softwareentwicklung


Re: Including external XML without XSP

Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message ----- 
From: "Uli Mayring" <ul...@denic.de>
To: "Cocoon Users List" <co...@xml.apache.org>
Sent: Monday, September 25, 2000 3:04 PM
Subject: Re: Including external XML without XSP


> On Mon, 25 Sep 2000, Berin Loritsch wrote:
> 
> > I want to know if I can include another file with all subelements
> > without using XSP.
> 
> Use the XInclude processor.
> 
> Ulrich

I can't find any docs, how does it work?

---------------------------------------------------------
If you lust for Ham and Eggs, you have
committed breakfast in your heart
already.   -- C. S. Lewis



Re: Including external XML without XSP

Posted by Uli Mayring <ul...@denic.de>.
On Mon, 25 Sep 2000, Berin Loritsch wrote:

> I want to know if I can include another file with all subelements
> without using XSP.

Use the XInclude processor.

Ulrich