You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Sean <ja...@wideasleep.com> on 2001/02/13 05:14:41 UTC

Xinclude files from other directories

I was wondering how someone would go about xincluding files in directories other then where they are being included from?  I am running Cocoon 2 but I don't think the Cocoon version should matter.

Here is what I am doing, I have one stylesheet in:

  resources/stylesheets/document/document-to-webpage.xsl

Which does 2 xincludes of files in:

  docs/
      sections.xml
      quotes.xml

I tried using the following xincludes:

1. <xinclude:include href="docs/sections.xml"/> - does not work
2. <xinclude:include href="/docs/sections.xml"/> - does not work
3. <xinclude:include href="/website/docs/sections.xml"/> - does not work
4. <xinclude:include href="sections.xml"/> - does not work

I have not resorted to ../../../docs/sections.xml because that seems like such a kludge.  Is there a better way to do this?  I was thinking if I defined a <map:match in the sitemap for the sections.xml I could do a read but this would expose this to other people that knew the name of the file and I doubt it would work.  Does anyone have any ideas on how to do this cleanly?

Thanks,
Sean

Re: Xinclude files from other directories

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 13 Feb 2001, Sean wrote:

> OK, so if I use the following it works:
>
> <xinclude:include parse="xml"
> href="http://localhost:8000/website/docs/sections.xml"/>
>
> Now the problems I see with this.
>
> 1. You have to embedd the absolute URL into the xinclude.
> 2. I had to add an xml matcher to the sitemap, this leaved my xml documents
> open to
>     anyone that knows their names and path.  This seems like a security risk
> to me.
> 3. It seems that xinclude should handle relative paths/urls but I cannot
> seem to get it to
>     work.
>
> Does anyone have any other ideas on how I can do this? Also, does anyone
> know if C2 supports XML Base?

the xinclude transformer in c2 is behind the times and needs updating. it
supports an old version of the xinclude language, i don't think it
supports xml base as it ought to, it doesn't do circular dependency
checking (afaik), and i don't think it even supports xpath queries (no SAX
XPath interface to xalan :(... ) help is welcome.

i'm sure your relative directory issues could be resolved by poking around
in the code and setting the sax system id properly or something like that.
give it a whirl. one important decision needs to be made first though -
when you're heading to something relative to a cocoon2 resource, is it
relative to that resource in url-space or file-space? (or sitemap-space?)
you might need to interact with the sitemap to find the location of the
resource in question.

i've pretty much abandoned development the xinclude processor and filter
for the time being, so anyone who wants to pick it up and carry it forth
is more than welcome to. it would be a good introductory project to c2...
:)

- donald


Re: Xinclude files from other directories

Posted by Sean <ja...@wideasleep.com>.
OK, so if I use the following it works:

<xinclude:include parse="xml"
href="http://localhost:8000/website/docs/sections.xml"/>

Now the problems I see with this.

1. You have to embedd the absolute URL into the xinclude.
2. I had to add an xml matcher to the sitemap, this leaved my xml documents
open to
    anyone that knows their names and path.  This seems like a security risk
to me.
3. It seems that xinclude should handle relative paths/urls but I cannot
seem to get it to
    work.

Does anyone have any other ideas on how I can do this? Also, does anyone
know if C2 supports XML Base?

Thanks in advance ...

Sean



Re: Xinclude files from other directories

Posted by Sean Willson <me...@seanwillson.com>.
I was under the impression that you could only use xsl:import or xsl:include
if you were including other stylesheets?  I want to include other xml
documents.  Here is what I am trying to do:

1. Load an xml file
2. Translate it with a stylesheet to add some web specific navigation (from
the sections.xml file) and some random quotes (from a quotes.xml) file.
Now, since this inclusion if being performed from withing a xsl stylesheet I
figured it was no big deal but I am having trouble specifying the href to
get to the xml files.
3. Run a transform to convert it into html

That is it ... it is mainly that I am not able to figure out a href that
will work.  My directory structure is:

/website/
    docs/
        index.xml
        sections.xml
        quotes.xml
    resources/
        stylesheets/
            docuement/
                document-to-webpage.xsl

So the index.xml is run through the document-to-webpage.xsl transform that
then in turn tried tp xinclude the sections.xml and quotes.xml but I cannot
get it to actually do this.  Any ideas?

Sean

----- Original Message -----
From: "Eduardo Yánez" <ej...@yahoo.com>
To: <co...@xml.apache.org>
Sent: Tuesday, February 13, 2001 10:43 AM
Subject: Re: Xinclude files from other directories


> Hi Sean,
>
> I have been using xinclude without problems using
> files in diferent directories as you wish. But i note
> that you are trying to include the files in a xsl
> file. As i know xinclude is for the xml files, no?.
> For the xsl files you can use xsl:import or
> xsl:include.
>
> I use xsl:import or xsl:include for importing or
> including other xsl style sheets files from other
> directories also.
>
> If i didn't solve your problem i can build a simple
> xinclude sample for your question.
>
> Regards,
> Eduardo
>
> --- Sean <ja...@wideasleep.com> escribió: > I was
> wondering how someone would go about
> > xincluding files in directories other then where
> > they are being included from?  I am running Cocoon 2
> > but I don't think the Cocoon version should matter.
> >
> > Here is what I am doing, I have one stylesheet in:
> >
> >
> >
> resources/stylesheets/document/document-to-webpage.xsl
> >
> > Which does 2 xincludes of files in:
> >
> >   docs/
> >       sections.xml
> >       quotes.xml
> >
> > I tried using the following xincludes:
> >
> > 1. <xinclude:include href="docs/sections.xml"/> -
> > does not work
> > 2. <xinclude:include href="/docs/sections.xml"/> -
> > does not work
> > 3. <xinclude:include
> > href="/website/docs/sections.xml"/> - does not work
> > 4. <xinclude:include href="sections.xml"/> - does
> > not work
> >
> > I have not resorted to ../../../docs/sections.xml
> > because that seems like such a kludge.  Is there a
> > better way to do this?  I was thinking if I defined
> > a <map:match in the sitemap for the sections.xml I
> > could do a read but this would expose this to other
> > people that knew the name of the file and I doubt it
> > would work.  Does anyone have any ideas on how to do
> > this cleanly?
> >
> > Thanks,
> > Sean
> >
>
>
> _________________________________________________________
> Do You Yahoo!?
> Obtenga su dirección de correo-e gratis @yahoo.com
> en http://correo.espanol.yahoo.com
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


Re: Xinclude files from other directories

Posted by Eduardo Yánez <ej...@yahoo.com>.
Hi Sean,

I have been using xinclude without problems using
files in diferent directories as you wish. But i note
that you are trying to include the files in a xsl
file. As i know xinclude is for the xml files, no?.
For the xsl files you can use xsl:import or
xsl:include.

I use xsl:import or xsl:include for importing or
including other xsl style sheets files from other
directories also.

If i didn't solve your problem i can build a simple
xinclude sample for your question.

Regards,
Eduardo

--- Sean <ja...@wideasleep.com> escribió: > I was
wondering how someone would go about
> xincluding files in directories other then where
> they are being included from?  I am running Cocoon 2
> but I don't think the Cocoon version should matter.
> 
> Here is what I am doing, I have one stylesheet in:
> 
>  
>
resources/stylesheets/document/document-to-webpage.xsl
> 
> Which does 2 xincludes of files in:
> 
>   docs/
>       sections.xml
>       quotes.xml
> 
> I tried using the following xincludes:
> 
> 1. <xinclude:include href="docs/sections.xml"/> -
> does not work
> 2. <xinclude:include href="/docs/sections.xml"/> -
> does not work
> 3. <xinclude:include
> href="/website/docs/sections.xml"/> - does not work
> 4. <xinclude:include href="sections.xml"/> - does
> not work
> 
> I have not resorted to ../../../docs/sections.xml
> because that seems like such a kludge.  Is there a
> better way to do this?  I was thinking if I defined
> a <map:match in the sitemap for the sections.xml I
> could do a read but this would expose this to other
> people that knew the name of the file and I doubt it
> would work.  Does anyone have any ideas on how to do
> this cleanly?
> 
> Thanks,
> Sean
> 


_________________________________________________________
Do You Yahoo!?
Obtenga su dirección de correo-e gratis @yahoo.com
en http://correo.espanol.yahoo.com