Re: variable using other variable? Works in Saxon, not in Xalan

Subject: Re: variable using other variable? Works in Saxon, not in Xalan
From: "Benoit Cerrina" <benoit.cerrina@xxxxxxxxxxx>
Date: Sun, 5 Nov 2000 16:45:32 +0100
Hi,
this is a xalan1.2 bug which is under correction, the problem only comes
with global variable.  This never surfaced before xalan1.2 because previous
version including 1.2D02 evaluated the global variable in document order (as
seem natural) however in 1.2 the order is reversed.  Therefore a quick fix
is to change the order of your variable declaration so the variable which
you need (dbquery) is defined after the one you where you use it (dbresult).
This should change since they (the xalan team are changing the way those are
handled) and order will not matter at all.
Benoit
----- Original Message -----
From: "Thorbjoern Ravn Andersen" <tra@xxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Thursday, November 02, 2000 10:24 PM
Subject: variable using other variable? Works in Saxon, not in Xalan




I have a snippet of code in a stylesheet looking like:

  <xsl:variable name="dbquery">

<xsl:text>http://127.0.0.1:8080/servlet/db2xml.servlet.DB2XMLServlet?dbQuery
=</xsl:text>
    <xsl:text>select%20*</xsl:text>
    <xsl:text>%20from%20collection%20</xsl:text>
    <xsl:text>where%20name='PRICE'%20</xsl:text>
    <xsl:text>and%20dataitemkey%20in%20(</xsl:text>
    <xsl:value-of select="$stocknumbers"/>
    <xsl:text>null)</xsl:text>
  </xsl:variable>

  <xsl:variable name="dbresult" select="document($dbquery)"/>


which constructs an URL in one variable and uses it as an argument to
document() in the next.  I did it with two variables since I otherwise
would need three set of quotes.  $stocknumbers is a string on the form
'1','2','3'

Saxon 5.4.1 executes this as I intended during development from the
command-line.  Xalan 1.2 reports the following error (which I call from
a servlet which uses processor.process to execute the stylesheet)

XSL Error: pattern = 'document($dbquery)'
VariableReference given for variable out of context or without
definition!  Name = dbquery, source tree node: #document

Which behaviour is correct?

How can I work around this problem with Xalan?

Thanks in advance for any replies,
--
  Thorbj?ørn Ravn Andersen                   "...sound of... Tubular Bells!"
  http://bigfoot.com/~thunderbear




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread