You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alejandro Raiczyk <al...@technisys.com.ar> on 2000/10/09 15:25:45 UTC
document(), xinclude or what ?
Hi people,
I have a xsl wich generates all the style of my pages, one
of the things it should do is to generate the navigation tree wich I have
defined in a XML file (menu.xml).
I want this menu.xml file, to be "included" by the XSL and then that the
corresponding template ( menu ) applies to it. I don't know how to "include"
this file from XSL.
I tried with
<xsl:value-of select="document('../menu.xml')"/>
<xsl:apply-templates select="menu"/>
and with
<include xinclude:parse="xml" xinclude:href="../menu.xml"/>
<xsl:apply-templates select="menu"/>
but it didn't work.
Help!
Thanks in advance.
Re: document(), xinclude or what ?
Posted by Paul Russell <pa...@luminas.co.uk>.
> Right now I am using xinclude to get menu.xml included. It is a kludge,
> because that is something I want taken care of at XSL time. Unfortunately,
> it is all done within the XML document itself.
Hardly dare suggest this, but you could always XSL transform an
xinclude element into place and *then* xinclude.
Paul
--
Paul Russell <pa...@luminas.co.uk>
Technical Director, http://www.luminas.co.uk
Luminas Ltd.
Re: document(), xinclude or what ?
Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message -----
From: "Steve A Drake" <sa...@comet.ucar.edu>
To: <co...@xml.apache.org>
Sent: Monday, October 09, 2000 1:35 PM
Subject: Re: document(), xinclude or what ?
> On Mon, 9 Oct 2000, Berin Loritsch wrote:
>
> >
> > ----- Original Message -----
> > From: "Steve A Drake" <sa...@comet.ucar.edu>
> > To: <co...@xml.apache.org>
> > Sent: Monday, October 09, 2000 1:01 PM
> > Subject: Re: document(), xinclude or what ?
> >
> >
> > > On Mon, 9 Oct 2000, Berin Loritsch wrote:
> > >
> > > > Can you give some example?
> > > >
> > > > every time I try to use
> > > > <xsl:apply-templates select="document('menu.xml')"/>
> > > > I get only one layer deep (I have menu groups as well).
> > > > I need the entire document to load.
> > >
> > > I had the same problem. I ended up building soft links to what you call
> > > 'menu.xml'. This also has an advantage of avoiding hardwiring a path in
> > > your XSL file.
> >
> > Soft links?
I changed my implementation to use the following construct:
<xsl:copy>
<xsl:apply-templates select="document('../menu.xml')"/>
</xsl:copy>
And it did the same thing xinclude did! I don't even have to have any hooks
in my original documentation which is exactly what I was looking for. I want
my business anylists not having to worry about that portion of the markup.
It needed to be PFM (Pure Fantabulous Magic) for them. (The actual meaning
of the acronym depends on your favorite F* adjective).
Re: document(), xinclude or what ?
Posted by Steve A Drake <sa...@comet.ucar.edu>.
On Mon, 9 Oct 2000, Berin Loritsch wrote:
>
> ----- Original Message -----
> From: "Steve A Drake" <sa...@comet.ucar.edu>
> To: <co...@xml.apache.org>
> Sent: Monday, October 09, 2000 1:01 PM
> Subject: Re: document(), xinclude or what ?
>
>
> > On Mon, 9 Oct 2000, Berin Loritsch wrote:
> >
> > > Can you give some example?
> > >
> > > every time I try to use
> > > <xsl:apply-templates select="document('menu.xml')"/>
> > > I get only one layer deep (I have menu groups as well).
> > > I need the entire document to load.
> >
> > I had the same problem. I ended up building soft links to what you call
> > 'menu.xml'. This also has an advantage of avoiding hardwiring a path in
> > your XSL file.
>
> Soft links?
>
> Right now I am using xinclude to get menu.xml included. It is a kludge,
> because that is something I want taken care of at XSL time. Unfortunately,
> it is all done within the XML document itself.
Yes, I also prefer using document() in the XSL file rather than xinclude
in the XML file.
As for soft links, if your server is some Unix variant, the command:
ln -s ../menu.xml menu.xml
creates a link, menu.xml, that points to ../menu.xml. So, you can then
use document('menu.xml') in your XSL file and use the link to point to the
actual location of the XML file.
I've included index.xml and index.xsl files that show how I'm using
document(). Equate your 'menu.xml' with my 'navbar.xml'. Note that I
pass in the name of the current document so that I can put a marker
next to it in the navigation bar. Hope this helps. Pass it back if you
make improvements!
Re: document(), xinclude or what ?
Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message -----
From: "Steve A Drake" <sa...@comet.ucar.edu>
To: <co...@xml.apache.org>
Sent: Monday, October 09, 2000 1:01 PM
Subject: Re: document(), xinclude or what ?
> On Mon, 9 Oct 2000, Berin Loritsch wrote:
>
> > Can you give some example?
> >
> > every time I try to use
> > <xsl:apply-templates select="document('menu.xml')"/>
> > I get only one layer deep (I have menu groups as well).
> > I need the entire document to load.
>
> I had the same problem. I ended up building soft links to what you call
> 'menu.xml'. This also has an advantage of avoiding hardwiring a path in
> your XSL file.
Soft links?
Right now I am using xinclude to get menu.xml included. It is a kludge,
because that is something I want taken care of at XSL time. Unfortunately,
it is all done within the XML document itself.
Re: document(), xinclude or what ?
Posted by Steve A Drake <sa...@comet.ucar.edu>.
On Mon, 9 Oct 2000, Berin Loritsch wrote:
> Can you give some example?
>
> every time I try to use
> <xsl:apply-templates select="document('menu.xml')"/>
> I get only one layer deep (I have menu groups as well).
> I need the entire document to load.
I had the same problem. I ended up building soft links to what you call
'menu.xml'. This also has an advantage of avoiding hardwiring a path in
your XSL file.
Re: document(), xinclude or what ?
Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 9 Oct 2000, Berin Loritsch wrote:
> > On Mon, 9 Oct 2000, Alejandro Raiczyk wrote:
> >
> > >
> > > Hi people,
> > > I have a xsl wich generates all the style of my pages, one
> > > of the things it should do is to generate the navigation tree wich I have
> > > defined in a XML file (menu.xml).
> > > I want this menu.xml file, to be "included" by the XSL and then that the
> > > corresponding template ( menu ) applies to it. I don't know how to "include"
> > > this file from XSL.
> > > I tried with
> > >
> > > <xsl:value-of select="document('../menu.xml')"/>
> > > <xsl:apply-templates select="menu"/>
> >
> > this is what you want to do, but you don't want to use xsl:value-of, you
> > want to use xsl:copy.
>
> Can you give some example?
>
> every time I try to use
> <xsl:apply-templates select="document('menu.xml')"/>
> I get only one layer deep (I have menu groups as well).
> I need the entire document to load.
this is an xslt specific question - please ask on the xsl list at
mulberrytech or check the xslt faqs.
- donald
Re: document(), xinclude or what ?
Posted by Berin Loritsch <bl...@infoplanning.com>.
----- Original Message -----
From: "Donald Ball" <ba...@webslingerZ.com>
To: <co...@xml.apache.org>
Sent: Monday, October 09, 2000 11:59 AM
Subject: Re: document(), xinclude or what ?
> On Mon, 9 Oct 2000, Alejandro Raiczyk wrote:
>
> >
> > Hi people,
> > I have a xsl wich generates all the style of my pages, one
> > of the things it should do is to generate the navigation tree wich I have
> > defined in a XML file (menu.xml).
> > I want this menu.xml file, to be "included" by the XSL and then that the
> > corresponding template ( menu ) applies to it. I don't know how to "include"
> > this file from XSL.
> > I tried with
> >
> > <xsl:value-of select="document('../menu.xml')"/>
> > <xsl:apply-templates select="menu"/>
>
> this is what you want to do, but you don't want to use xsl:value-of, you
> want to use xsl:copy.
Can you give some example?
every time I try to use
<xsl:apply-templates select="document('menu.xml')"/>
I get only one layer deep (I have menu groups as well).
I need the entire document to load.
Re: document(), xinclude or what ?
Posted by Donald Ball <ba...@webslingerZ.com>.
On Mon, 9 Oct 2000, Alejandro Raiczyk wrote:
>
> Hi people,
> I have a xsl wich generates all the style of my pages, one
> of the things it should do is to generate the navigation tree wich I have
> defined in a XML file (menu.xml).
> I want this menu.xml file, to be "included" by the XSL and then that the
> corresponding template ( menu ) applies to it. I don't know how to "include"
> this file from XSL.
> I tried with
>
> <xsl:value-of select="document('../menu.xml')"/>
> <xsl:apply-templates select="menu"/>
this is what you want to do, but you don't want to use xsl:value-of, you
want to use xsl:copy.
> and with
>
> <include xinclude:parse="xml" xinclude:href="../menu.xml"/>
> <xsl:apply-templates select="menu"/>
>
> but it didn't work.
you can't do xincludes inside a stylesheet, only in the source xml.
- donald