You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Dave Webster <da...@itouch.co.za> on 2000/10/25 10:00:50 UTC

xml import/include paths

Howzit All?

Sorry if this has been discussed before, but 2 months of trolling through
the archives provided no satisfactory answers.

I'm using the SampleTransform.cpp example that comes with
Xalan 1.0 for Linux and have a foo.xsl file with the line:

<xsl:include href="file:/tmp/bar.xsl"/>
...
other stuff
...


The problem is when I apply the transformation with the sample code,
it looks for /tmp/bar.xsl under my current directory (i.e. /home/dave/tmp/
bar.xsl) instead of being an absolute path (i.e. /tmp/bar.xsl).

I'm assuming it's something to do with the way I create my
XSLTInputSource :

                const XalanDOMString        theXMLFileName("foo.xml");
                const XalanDOMString        theXSLFileName("foo.xsl");

                // Our input sources...
                XSLTInputSource     theInputSource(c_wstr(theXMLFileName));
                XSLTInputSource
theStylesheetSource(c_wstr(theXSLFileName));

But I've tried many varitions and all the constructors for XSLTInputSource
but no luck yet.  Could anyone kindly tell me what combination of SystemID and

publicID I need to specify to be able to specify absoulte include/import
references in my XSL?

Thanks very much!

-d.w.
:-)





Re: xml import/include paths

Posted by Dave Webster <da...@itouch.co.za>.
Howzit Fabian,

Thanks for the reply ... Unfortunately, we/I have a whole tree structure
of include files (much like a "C" program would), so my stylesheet(s)
will definitely include/import other stylesheets.

The referencing works fine with the Java version of Xalan on Linux;
but I'm trying to re-write the translation code in C/C++ (again on Linux)
for some speed comparisions which is where the bug came about for me.

Anyways, thanks again, and if anyone has any further insights, they would
be appreciated.

-d.w.
:-)

Fabian Huschka wrote:

> Hi Dave,
>
> I just ran into the same problem. However I figured something out.
>
> I do include a stylesheet within my XML documents by referencing
> it in regard of the root path to the XML document:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE modules SYSTEM "../dtd/modules.dtd">
> <?xml-stylesheet type="text/xsl" href="../xsl/modules.xsl"?>
>
> This works fine as long as I do not import/include another stylesheet
> within the already referenced stylesheet.
>
> For example the root path is somedrive:\documents\xml\
> The path to the XSL documents is somedrive\documents\xml\xslt
>
> The errormessage looks like this:
>
> somedrive\documents\xslt\secondref.xsl - Could not find the requested document.
>                                       ^^^^^^
> The path is messed up - Xalan has forgotten to add the xml directory.
> (By the way this bug also occures on linux and solaris)
>
> Well I played around with it a bit and found out that in case I name the
> reference to the first stylesheet on the commandline everything works
> fine. I guess that this is a bug which arouses whenever you try to reference
> more than two documents recursivly.
>
> Fabian
>
> Dave Webster schrieb:
>
> > Howzit All?
> >
> > Sorry if this has been discussed before, but 2 months of trolling through
> > the archives provided no satisfactory answers.
> >
> > I'm using the SampleTransform.cpp example that comes with
> > Xalan 1.0 for Linux and have a foo.xsl file with the line:
> >
> > <xsl:include href="file:/tmp/bar.xsl"/>
> > ...
> > other stuff
> > ...
> >
> > The problem is when I apply the transformation with the sample code,
> > it looks for /tmp/bar.xsl under my current directory (i.e. /home/dave/tmp/
> > bar.xsl) instead of being an absolute path (i.e. /tmp/bar.xsl).
> >
> > I'm assuming it's something to do with the way I create my
> > XSLTInputSource :
> >
> >                 const XalanDOMString        theXMLFileName("foo.xml");
> >                 const XalanDOMString        theXSLFileName("foo.xsl");
> >
> >                 // Our input sources...
> >                 XSLTInputSource     theInputSource(c_wstr(theXMLFileName));
> >                 XSLTInputSource
> > theStylesheetSource(c_wstr(theXSLFileName));
> >
> > But I've tried many varitions and all the constructors for XSLTInputSource
> > but no luck yet.  Could anyone kindly tell me what combination of SystemID and
> >
> > publicID I need to specify to be able to specify absoulte include/import
> > references in my XSL?
> >
> > Thanks very much!
> >
> > -d.w.
> > :-)

Re: xml import/include paths

Posted by Fabian Huschka <fa...@dreicsystems.de>.
Hi Dave,

I just ran into the same problem. However I figured something out.

I do include a stylesheet within my XML documents by referencing
it in regard of the root path to the XML document:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE modules SYSTEM "../dtd/modules.dtd">
<?xml-stylesheet type="text/xsl" href="../xsl/modules.xsl"?>

This works fine as long as I do not import/include another stylesheet
within the already referenced stylesheet.

For example the root path is somedrive:\documents\xml\
The path to the XSL documents is somedrive\documents\xml\xslt

The errormessage looks like this:

somedrive\documents\xslt\secondref.xsl - Could not find the requested document.
                                      ^^^^^^
The path is messed up - Xalan has forgotten to add the xml directory.
(By the way this bug also occures on linux and solaris)

Well I played around with it a bit and found out that in case I name the
reference to the first stylesheet on the commandline everything works
fine. I guess that this is a bug which arouses whenever you try to reference
more than two documents recursivly.


Fabian

Dave Webster schrieb:

> Howzit All?
>
> Sorry if this has been discussed before, but 2 months of trolling through
> the archives provided no satisfactory answers.
>
> I'm using the SampleTransform.cpp example that comes with
> Xalan 1.0 for Linux and have a foo.xsl file with the line:
>
> <xsl:include href="file:/tmp/bar.xsl"/>
> ...
> other stuff
> ...
>
> The problem is when I apply the transformation with the sample code,
> it looks for /tmp/bar.xsl under my current directory (i.e. /home/dave/tmp/
> bar.xsl) instead of being an absolute path (i.e. /tmp/bar.xsl).
>
> I'm assuming it's something to do with the way I create my
> XSLTInputSource :
>
>                 const XalanDOMString        theXMLFileName("foo.xml");
>                 const XalanDOMString        theXSLFileName("foo.xsl");
>
>                 // Our input sources...
>                 XSLTInputSource     theInputSource(c_wstr(theXMLFileName));
>                 XSLTInputSource
> theStylesheetSource(c_wstr(theXSLFileName));
>
> But I've tried many varitions and all the constructors for XSLTInputSource
> but no luck yet.  Could anyone kindly tell me what combination of SystemID and
>
> publicID I need to specify to be able to specify absoulte include/import
> references in my XSL?
>
> Thanks very much!
>
> -d.w.
> :-)