Global variable not working in my XSL

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"/>

....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top