|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL problem
"Wnuk, Thomas" <Thomas.Wnuk@xxxxxxxx> wrote:
> > I haven't been able to implement xsl:variable in my xsl files. Xalan
> reports that it is out of context or not defined.
Hmm... you're stylesheet didn't seem very compliant. I modified your
fragment to read as follows:
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/REC-html40"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<title>Test</title>
<body>
<xsl:variable name="rdate">
02/02/2000
</xsl:variable>
<form>
<center>
<table>
<tr>
<td valign="middle" align="right"><b>Date: </b></td>
<td valign="middle" align="left">
<input type="text" name="rdate" size="10" value="{normalize-space
($rdate)}"></input>
</td>
</tr>
</table>
</center>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Note that I wrapped the call to the variable with a normalize-space, which
I don't think had anything to do with your problem, but which strips the
leading and trailing space.
On my machine, the result was:
C:\x\xml-xalan\sheets\xdtm>testo test\A
classpath: c:\x\xml-xerces\java\xerces.jar;c:\x\xml-xalan\xalan.jar;c:
\x\xml-xal
an\bsf.jar;c:\x\xml-xalan\bsfengines.jar;c:\x\xml-xalan\js.jar;c:
\x\xml-xalan\sh
eets\ext;.;C:\JDK\JRE\LIB\RT.JAR
test results to System.out
<html xmlns="http://www.w3.org/TR/REC-html40">
<title>Test</title>
<body>
<form>
<center>
<table>
<tr>
<td align="right" valign="middle"><b>Date:
</b></td><td
align="left" valign="middle"><input value="02/02/2000" size="10" name
="rdate" ty
pe="text"></td>
</tr>
</table>
</center>
</form>
</body>
</html>
...no problem with xsl:variable that I could see.
-scott
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








