[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Variables and Parameters in SAXON

Subject: Variables and Parameters in SAXON
From: Scott Sanders <scott@xxxxxxxxxxxx>
Date: Fri, 17 Dec 1999 12:49:01 -0700
saxon parameters
Title: Variables and Parameters in SAXON

I have an XML document and a stylesheet that used to work with SAXON 4.x, but after having upgraded to 5.0, it fails with the error variable 'xxx' not defined.  Is this some type of scoping issue?  If it is, how do I reference a top level variable, or a parameter that I am passing in from a servlet?

test.xml:
<?xml version="1.0"?>
<screen title="titletest">
        <search type="searchtest"/>
</screen>

test.xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/TR/REC-html40" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html"/>
<xsl:variable name="testvar">TESTING</xsl:variable>
<xsl:param name="search"/>

<xsl:template match="screen">
<html>
<head>
<title>Testing <xsl:value-of select="@title"/></title>
</head>
<body>
<h1 class="title"><xsl:value-of select="@title"/></h1>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="search">
<h2>This is a test<xsl:value-of select="$testvar"/></h2>
</xsl:template> <!--search-->
</xsl:stylesheet>

When I run the following:
java com.icl.saxon.StyleSheet test.xml test.xsl >test.html

I get the following error:
Error preparing style sheet
At xsl:value-of on line 21 of file:/D:/web/content/xmldocs/test.xsl: Variable testvar has not been declared

Can anyone help?

TIA,
Scott Sanders

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.