xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Boag/CAM/Lotus" <Scott_B...@lotus.com>
Subject Re: xsl:output, xsl:include, xsl:import support and file base
Date Fri, 07 Jan 2000 18:56:35 GMT

Sorry, I must have missed the original message.

> (StylesheetHandler) Imports can only occur as the first elements in the
> stylesheet!

This is a valid error.  The stylesheet is not compliant with the standard.
Import needs to be the first elements, according to the standard.

     <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:import href="file:/usr/local/fusion3/root/bug/include.xsl"/>
          <xsl:output method="html"/>
     </xsl:stylesheet>

> org.apache.xerces.dom.DOMExceptionImpl: HIERARCHY_REQUEST_ERR

Strange.  This looks like something is trying to add a text node to the DOM
root node, and it doesn't like it.  Ted, does this seem right?

> but what if i want relative path like xcv/index.xsl ?

Aside from the proper relative URL, you should be able to just use
<xsl:include href="category.xsl"/>.

> > > second thing, in cocoon, if i include a xsl in another xsl with
> <xsl:include
> > > href="category.xsl"/> (because the included xsl is in the same
directory),

This should work fine from the standpoint of Xalan.

The Cocoon code needs to do something along the lines of the following:

    public Document transform(Document in, String inBaseID, Document sheet,
String sheetBaseID, Document out)
     throws Exception {
        XSLTInputSource i = new XSLTInputSource(in);
        i.setSystemId (inBaseID);  // Make it so Xerces can find relative
entities and DTDs
        XSLTInputSource s = new XSLTInputSource(sheet);
        i.setSystemId (sheetBaseID);  // Make it so Xalan can find relative
xsl:include and xsl:import
        XSLTResultTarget o = new XSLTResultTarget(out);
        processor.process(i, s, o);
        return out;
    }

Stefano, does this make sense?  Is it doable?

-scott




                                                                                         
                         
                    "Vincent-Oliv                                                        
                         
                    ier                  To:     <general@xml.apache.org>          
                               
                    Arsenault"           cc:     (bcc: Scott Boag/CAM/Lotus)             
                         
                    <vincent@stri        Subject:     Re: xsl:output, xsl:include, xsl:import
support and file     
                    a.com>               base                                         
                            
                                                                                         
                         
                    01/07/00                                                             
                         
                    12:31 PM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    general                                                              
                         
                                                                                         
                         
                                                                                         
                         




Hi!

I just downloaded the cvs tree this morning (xalan + cocoon). xsl:output
seems to work except for indent="yes" (i don't even know if it supposed to
be a feature anyways, but i've seen it in some xsl in xalan).

but still nothing for xsl:include nor xsl:import

----- Original Message -----
From: "Stefano Mazzocchi" <stefano@apache.org>
To: <general@xml.apache.org>
Sent: Thursday, January 06, 2000 7:20 PM
Subject: Re: xsl:output, xsl:include, xsl:import support and file base


> Vincent-Olivier Arsenault wrote:
> >
> > xsl:output, xsl:include and xsl:import don't work.
> >
> > <xsl:output method="html"/> and xsl:include do absolutly nothing and
> > xsl:import always generates the "must be on top of stylesheet error".
Maybe
> > it's me but then, may I have a working example? I'm using cocoon.
> >
> > second thing, in cocoon, if i include a xsl in another xsl with
<xsl:include
> > href="category.xsl"/> (because the included xsl is in the same
directory),
> > it says cannot find file:/usr/local/category.xsl, but if I write
> > <xsl:include href="file:/usr/local/fusion3/root/xper/category.xsl"/>
there
> > is no error message (it still doesn't work tough).
>
> have you tried
>
>  file:///usr/local/....
>
> this is the right syntax for the "file" protocol.

yes, and then it "works" (no more file not found error), but what if i want
relative path like xcv/index.xsl ?

yet, if i try xsl:import i get:



              org.apache.xalan.xslt.XSLProcessorException:
(StylesheetHandler) Imports can only occur as the first elements in the
stylesheet!
                      at
org.apache.xalan.xslt.XSLTEngineImpl.error(XSLTEngineImpl.java, Compiled
Code)
                      at
org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl.java,
Compiled Code)
                      at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java, Compiled
Code)
                      at
org.apache.cocoon.transformer.XalanTransformer.transform(XalanTransformer.ja

va, Compiled Code)
                      at
org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.java,
Compiled Code)
                      at org.apache.cocoon.Engine.handle(Engine.java,
Compiled Code)
                      at org.apache.cocoon.Cocoon.service(Cocoon.java,
Compiled Code)
                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
                      at
org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:6

26)
                      at
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java,
Compiled Code)
                      at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)

                      at
org.apache.tomcat.core.Context.handleRequest(Context.java, Compiled Code)
                      at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
                      at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection

(Ajp12ConnectionHandler.java, Compiled Code)
                      at
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java,
Compiled
Code)
                      at java.lang.Thread.run(Thread.java, Compiled Code)
              ---------
              org.xml.sax.SAXException: (StylesheetHandler) Imports can
only
occur as the first elements in the stylesheet!
                      at
org.apache.xalan.xslt.StylesheetHandler.processImport(StylesheetHandler.java

:1165)
                      at
org.apache.xalan.xslt.StylesheetHandler.startElement(StylesheetHandler.java,

Compiled Code)
                      at
org.apache.xalan.xpath.xml.TreeWalker.startNode(TreeWalker.java, Compiled
Code)
                      at
org.apache.xalan.xpath.xml.TreeWalker.traverse(TreeWalker.java, Compiled
Code)
                      at
org.apache.xalan.xslt.XSLTEngineImpl.processStylesheet(XSLTEngineImpl.java,
Compiled Code)
                      at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java, Compiled
Code)
                      at
org.apache.cocoon.transformer.XalanTransformer.transform(XalanTransformer.ja

va, Compiled Code)
                      at
org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.java,
Compiled Code)
                      at org.apache.cocoon.Engine.handle(Engine.java,
Compiled Code)
                      at org.apache.cocoon.Cocoon.service(Cocoon.java,
Compiled Code)
                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
                      at
org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:6

26)
                      at
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java,
Compiled Code)
                      at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)

                      at
org.apache.tomcat.core.Context.handleRequest(Context.java, Compiled Code)
                      at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
                      at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection

(Ajp12ConnectionHandler.java, Compiled Code)
                      at
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java,
Compiled
Code)
                      at java.lang.Thread.run(Thread.java, Compiled Code)


and with xsl:include:

org.apache.xerces.dom.DOMExceptionImpl: HIERARCHY_REQUEST_ERR
                       at
org.apache.xerces.dom.NodeImpl.internalInsertBefore(NodeImpl.java, Compiled
Code)
                       at
org.apache.xerces.dom.NodeImpl.insertBefore(NodeImpl.java, Compiled Code)
                       at
org.apache.xerces.dom.DocumentImpl.insertBefore(DocumentImpl.java, Compiled
Code)
                       at
org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java, Compiled Code)
                       at
org.apache.xalan.xpath.xml.FormatterToDOM.append(FormatterToDOM.java,
Compiled Code)
                       at
org.apache.xalan.xpath.xml.FormatterToDOM.characters(FormatterToDOM.java,
Compiled Code)
                       at
org.apache.xalan.xslt.XSLTEngineImpl$ResultTreeHandler.characters(XSLTEngine
Impl.java, Compiled Code)
                       at
org.apache.xalan.xslt.XSLTEngineImpl.cloneToResultTree(XSLTEngineImpl.java,
Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplateElement.transformChild(ElemTemplateElement

.java, Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplateElement.transformSelectedChildren(ElemTemp

lateElement.java, Compiled Code)
                       at
org.apache.xalan.xslt.ElemApplyTemplates.execute(ElemApplyTemplates.java,
Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElemen

t.java, Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplateElement.transformChild(ElemTemplateElement

.java, Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplateElement.transformSelectedChildren(ElemTemp

lateElement.java, Compiled Code)
                       at
org.apache.xalan.xslt.ElemApplyTemplates.execute(ElemApplyTemplates.java,
Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplateElement.executeChildren(ElemTemplateElemen

t.java, Compiled Code)
                       at
org.apache.xalan.xslt.ElemTemplate.execute(ElemTemplate.java, Compiled
Code)
                       at
org.apache.xalan.xslt.StylesheetRoot.process(StylesheetRoot.java:398)
                       at
org.apache.xalan.xslt.XSLTEngineImpl.process(XSLTEngineImpl.java, Compiled
Code)
                       at
org.apache.cocoon.transformer.XalanTransformer.transform(XalanTransformer.ja

va, Compiled Code)
                       at
org.apache.cocoon.processor.xslt.XSLTProcessor.process(XSLTProcessor.java,
Compiled Code)
                       at org.apache.cocoon.Engine.handle(Engine.java,
Compiled Code)
                       at org.apache.cocoon.Cocoon.service(Cocoon.java,
Compiled Code)
                       at
javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
                       at
org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:6

26)
                       at
org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java,
Compiled Code)
                       at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)

                       at
org.apache.tomcat.core.Context.handleRequest(Context.java, Compiled Code)
                       at
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled
Code)
                       at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection

(Ajp12ConnectionHandler.java, Compiled Code)
                       at
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java,
Compiled
Code)
                       at java.lang.Thread.run(Thread.java, Compiled Code)

i've included my xml and xsl in a zip file. of course you'll need to change
the absolute path in index.xsl

thanks

--vincent

(See attached file: Bug.zip)


Mime
View raw message