This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Variable confusion
- From: "Stuart Celarier" <stuart at ferncrk dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 16 May 2002 09:32:26 -0700
- Subject: RE: [xsl] Variable confusion
- Reply-to: xsl-list at lists dot mulberrytech dot com
Tim, it is hard to say what the problem is without seeing more of the
XSLT stylesheet and the two XML source documents. A couple quick things:
Be certain that there is no other <xsl:variable> named 'pageNum' defined
at template-scope which would hide the top-level <xsl:variable> of the
same name.
Try stripping down the problem case: radically simplify the XML source
documents and XSLT stylesheet document until either (1) you spot the
problem or (2) you have a very small set of documents that illustrate
the problem and nothing else. Do it in a couple of steps, so you can
tell what you changed and put it back when the behavior changes. Divide
and conquer.
If that doesn't solve your problem, post a short example that
illustrates the problem.
Observe that your global variable uses the XPath expression
"/storpres/est/general/trans-page" whereas the alert evaluates this
expression "storpres/est/general/trans-page". The first expression
begins at the root node, the second expression is relative to the
context in which it is evaluated (no leading /). Is that the problem?
What is the <!DOCTYPE storpres> declaration doing in the stylesheet
document? The root element of this document is <xsl:stylesheet>, not
<storpres>. See the XML spec, 2.8 Prolog and Document Type Declaration
(http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd), the
paragraph marked Validity constraint: Root Element Type.
Cheers,
Stuart
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list