You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Fergus Gallagher <Fe...@OrbisUK.com> on 2000/11/10 13:49:37 UTC

Problem using

I am having difficulties with <xsl:import>.  What is wrong with my syntax?

The problem is definitely the import expression, as I get no error when the 
line is removed.

The relevant Java code is

         StylesheetRoot style = proc.processStylesheet(
             new XSLTInputSource("informix.xsl"));

Replacing "informix.xsl" with "tables.xsl" works fine.

I have xalan-j_1_2

Thanks,

Fergus

==== informix.xsl ======

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet
     version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:import href="tables.xsl"/>
</xsl:stylesheet>


===== error ======

XSL Error: Could not parse file:informix.xsl document!
Exception in thread "main" org.apache.xalan.xslt.XSLProcessorException: 
XercesLiaison.parse error
         at 
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1710)
         at 
org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl.java:770)
         at 
com.orbisuk.utils.xml.XSLTransform.setStylesheet(XSLTransform.java:33)
         at 
com.orbisuk.utils.xml.XSLTransform.setStylesheet(XSLTransform.java:25)
         at com.orbisuk.utils.xml.XSLTransform.main(XSLTransform.java:94)


-- 
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717


Re: Problem using

Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
Yes, that works, as does "file:./file.xsl" (but not "file:file.xsl", 
strangely).

But the problem  as I see it is that it's relative to the current location, 
not the parent stylesheet, so stylesheets become horribly non-portable.

The XSLT spec (http://www.w3.org/TR/xslt.html#import) says,

"The xsl:import element has an href attribute whose value is a URI 
reference identifying the stylesheet to be imported. A relative URI is 
resolved relative to the base URI of the xsl:import element"

This seems to be a serious limitation, or am I over-reacting?

Fergus

P.S. I thought

     <xsl:param name="prefix" select="'file:./'"/>
     <xsl:import href="{$prefix}tables.xsl"/>

might work, and then supply the actual location as a runtime parameter, but 
imports have to be the first thing in a stylesheet, even if the {$prefix} 
were evaluated in this context.


At 19:05 10/11/00 +0600, Sergey S. Kljopov wrote:
>Perhaps you might pass to the XSLTInputSource full path to the your xsl?
>----- Original Message -----
>From: "Fergus Gallagher" <Fe...@OrbisUK.com>
>To: <xa...@xml.apache.org>
>Sent: Friday, November 10, 2000 6:49 PM
>Subject: Problem using <xsl:import>
>
>
> > I am having difficulties with <xsl:import>.  What is wrong with my syntax?
> >
> > The problem is definitely the import expression, as I get no error when
>the
> > line is removed.
> >
> > The relevant Java code is
> >
> >          StylesheetRoot style = proc.processStylesheet(
> >              new XSLTInputSource("informix.xsl"));
> >
> > Replacing "informix.xsl" with "tables.xsl" works fine.
> >
> > I have xalan-j_1_2
> >
> > Thanks,
> >
> > Fergus
> >
> > ==== informix.xsl ======
> >
> > <?xml version="1.0" encoding="iso-8859-1"?>
> > <xsl:stylesheet
> >      version="1.0"
> >      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> >      <xsl:import href="tables.xsl"/>
> > </xsl:stylesheet>
> >
> >
> > ===== error ======
> >
> > XSL Error: Could not parse file:informix.xsl document!
> > Exception in thread "main" org.apache.xalan.xslt.XSLProcessorException:
> > XercesLiaison.parse error
> >          at
> > org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1710)
> >          at
> >
>org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl.java:7
>70)
> >          at
> > com.orbisuk.utils.xml.XSLTransform.setStylesheet(XSLTransform.java:33)
> >          at
> > com.orbisuk.utils.xml.XSLTransform.setStylesheet(XSLTransform.java:25)
> >          at com.orbisuk.utils.xml.XSLTransform.main(XSLTransform.java:94)
> >
> >
> > --
> > Fergus Gallagher
> > Orbis
> > http://www.orbisuk.com/
> > +44-(0)20-8987 0717
> >

-- 
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717


Re: Problem using

Posted by "Sergey S. Kljopov" <kl...@wetellyou.com>.
Perhaps you might pass to the XSLTInputSource full path to the your xsl?
----- Original Message -----
From: "Fergus Gallagher" <Fe...@OrbisUK.com>
To: <xa...@xml.apache.org>
Sent: Friday, November 10, 2000 6:49 PM
Subject: Problem using <xsl:import>


> I am having difficulties with <xsl:import>.  What is wrong with my syntax?
>
> The problem is definitely the import expression, as I get no error when
the
> line is removed.
>
> The relevant Java code is
>
>          StylesheetRoot style = proc.processStylesheet(
>              new XSLTInputSource("informix.xsl"));
>
> Replacing "informix.xsl" with "tables.xsl" works fine.
>
> I have xalan-j_1_2
>
> Thanks,
>
> Fergus
>
> ==== informix.xsl ======
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet
>      version="1.0"
>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>      <xsl:import href="tables.xsl"/>
> </xsl:stylesheet>
>
>
> ===== error ======
>
> XSL Error: Could not parse file:informix.xsl document!
> Exception in thread "main" org.apache.xalan.xslt.XSLProcessorException:
> XercesLiaison.parse error
>          at
> org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java:1710)
>          at
>
org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl.java:7
70)
>          at
> com.orbisuk.utils.xml.XSLTransform.setStylesheet(XSLTransform.java:33)
>          at
> com.orbisuk.utils.xml.XSLTransform.setStylesheet(XSLTransform.java:25)
>          at com.orbisuk.utils.xml.XSLTransform.main(XSLTransform.java:94)
>
>
> --
> Fergus Gallagher
> Orbis
> http://www.orbisuk.com/
> +44-(0)20-8987 0717
>