P
PatrickRThomas
This question has probably been asked a million times, but I can't get
this to work.
I'm trying to create a global variable that contains some HTML so that
I can reference it from multiple templates. For some reason, the
templates don't seem to be able to see this variable. What am I doing
wrong? (I'm using XMLSpy 2005.) Here is a snip of my code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="MasterSpacer">
<tr>
<td height="20"/>
</tr>
</xsl:variable>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="/stylesheet/MyStyles.css"/>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<xsl:apply-templates select="data/header"/>
<xsl:apply-templates select="data/body"/>
</table>
</body>
</html>
</xsl:template>
....
<xsl:template match="body">
<xsl:copy-of select="$MasterSpacer"/>
....
this to work.
I'm trying to create a global variable that contains some HTML so that
I can reference it from multiple templates. For some reason, the
templates don't seem to be able to see this variable. What am I doing
wrong? (I'm using XMLSpy 2005.) Here is a snip of my code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="MasterSpacer">
<tr>
<td height="20"/>
</tr>
</xsl:variable>
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css"
href="/stylesheet/MyStyles.css"/>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" align="center">
<xsl:apply-templates select="data/header"/>
<xsl:apply-templates select="data/body"/>
</table>
</body>
</html>
</xsl:template>
....
<xsl:template match="body">
<xsl:copy-of select="$MasterSpacer"/>
....