| Subject: Re: XSL problem From: "Scott Boag/CAM/Lotus" <Scott_Boag@xxxxxxxxx> Date: Fri, 4 Feb 2000 18:17:11 -0500 | 
"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
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| XSL problem, Wnuk, Thomas | Thread | localizing XML/XSLT with entities?, Ray Cromwell | 
| XSL problem, Wnuk, Thomas | Date | RE: Declaring internal entities in , John E. Simpson | 
| Month |