You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Benoit Cerrina <be...@writeme.com> on 2000/11/01 21:34:11 UTC

Re: Losing top-level parameters when moving from Xalan-J 1.2.d01 to 1.2.0

Hi,
A very good idea, yes their is a major regression concerning top level
variables and parameters in version 1.2.0 compared to 1.2.d01, which
prevents you from using a top level variable or parameter to compute another
one.
Benoit
----- Original Message -----
From: "Charles Douthart" <Ch...@Trifolium.com>
To: <xa...@xml.apache.org>; <xs...@mulberrytech.com>
Sent: Wednesday, November 01, 2000 7:46 PM
Subject: Losing top-level parameters when moving from Xalan-J 1.2.d01 to
1.2.0


> I'm currently trying to upgrade our XSL components from Xalan1.2.D01 to
> Xalan1.2.0 and have encountered a problem with paramters. It appears
> that top-level paramters are no longer visible to the XSL processor.
>
> the code that handles most of the processing is as follows:
>
>     // Chaned to liason for Xerces 1.2.0
>     XSLTProcessor processor =
> org.apache.xalan.xslt.XSLTProcessorFactory.getProcessor(new
> org.apache.xalan.xpath.xdom.XercesLiaison());
>     XSLTInputSource xmlSource = new XSLTInputSource(doc);  // doc is an
> org.w3c.dom.Document
>     XSLTInputSource xslSource = new XSLTInputSource(transformName);
>
>     Iterator keys = rendererProperties.keySet().iterator();
>     System.out.println("XSL Processor Paramters:");
>     while (keys.hasNext())
>     {
>         String key = (String)keys.next();
>         String value = (String)rendererProperties.get(key);
>         System.out.println("\t" + key + ": " + value);
>         processor.setStylesheetParam(key, value);
>     }
>
>     processor.process(xmlSource, xslSource,new
> XSLTResultTarget(httpResponse.getWriter()));
>
>
>
> And the transformation is:
>
>     <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> Note: These parameters are defined in another file and included using
> <xsl:include href="stdparams.xsl"/>
>         <xsl:param name = "NAVIGATION_ROOT" select = "'root'"/>
>         <xsl:param name = "SERVLET_PATH" select = "'null'"/>
>         <xsl:param name = "CONTEXT_PATH" select = "'null'"/>
>         <xsl:variable name = "FULL_SERVLET_PATH" select =
> "concat($CONTEXT_PATH,$SERVLET_PATH)"/>
>         <xsl:variable name = "SERVLET_NAME" select =
> "substring($SERVLET_PATH,2)"/>
>
>
>         <xsl:template match="/">
>
>             <HTML>
>                 <HEAD>
>                     ... header here
>                 </HEAD>
>                 <BODY >
>                     ... body here
>                 </BODY>
>              </HTML>
>             </xsl:template>
>     </xsl:stylesheet>
>
> This transformation is applied to a _very_ simple, valid document that is
> constructed from an in-memory string. All ran well under D01, but after
> changing to 1.2.0, I get the following output:
>
>     XSL Processor Paramters:
>         NAVIGATION_ROOT: 'undefined'
>         CONTEXT_PATH: '/ctx'
>         SERVLET_PATH: '/Main'
>
>
>     XSL Error: pattern = 'substring($SERVLET_PATH,2)'
>     VariableReference given for variable out of context or without
> definition!  Name = SERVLET_PATH, source tree node: #document
>     XSL Error: SAX Exception
>     org.apache.xalan.xslt.XSLProcessorException: pattern =
> 'substring($SERVLET_PATH,2)'
>     VariableReference given for variable out of context or without
> definition!  Name = SERVLET_PATH
>         at java.lang.Throwable.<init>(Throwable.java:96)
>         at java.lang.Exception.<init>(Exception.java:44)
>         at org.xml.sax.SAXException.<init>(SAXException.java:38)
>
> Any idea what is happening to my parameters?
>
>
> TIA,
> Charles Douthart
> Trifolium, inc
>
>
>
>
>