[xsl] Err, XSLT problem?

Subject: [xsl] Err, XSLT problem?
From: "Daniel Newman" <daniel.newman@xxxxxxxxxxx>
Date: Wed, 18 Apr 2001 15:13:31 +0100
Hi all,

sorry to bother you with this one, BUT, in XML spy, the following two files
are generating an xHTML file with no errors, but when I try and do a
server-side transformNode command, I'm getting an "Keyword xsl:call-template
may not be used here."?

The two files (XML & XSL) are below...

Hope someone can find something that might be causing a problem?  I'm using
MSXML2.dll (although I have just tried to install the msxml3sp1).

================== XML =======================
<?xml version="1.0"?>
<Shareholder_Summary><RetrieveNameAndAddressRSResponse>
		<Result>0</Result>
		<PostCode>EH11 4BR</PostCode>
		<HolderDateOfBirth>00000000</HolderDateOfBirth>
		<NameAddress1>MR COLIN MALCOLM ABBOTT</NameAddress1>
		<NameAddress2>10 SMITH STREET</NameAddress2>
		<NameAddress3>ANY TOWN</NameAddress3>
		<NameAddress4>ANY COUNTY</NameAddress4>
		<NameAddress5>ANYWHERE</NameAddress5>
		<HolderTypeCode>MAL</HolderTypeCode>
		<HolderStatusDeceased>N</HolderStatusDeceased>
		<HolderStatusStopTrade>N</HolderStatusStopTrade>
		<HolderStatusAnnualReport>A</HolderStatusAnnualReport>
		<HolderNameKey>ABBOTT      COLIN MALCOL</HolderNameKey>
		<HolderSystemNoteFlag>N</HolderSystemNoteFlag>
		<HolderSystemDRPFlag>N</HolderSystemDRPFlag>
		<HolderSystemPayeeFlag>D</HolderSystemPayeeFlag>
		<HolderSystemMergeFlag>N</HolderSystemMergeFlag>
		<WarningMessage1>Payee instruction direct/bulk</WarningMessage1>
		<HolderSurname>ABBOTT</HolderSurname>
		<HolderReturnMail>00000000</HolderReturnMail>
		<HolderOnDate>01121994</HolderOnDate>
		<HolderOffDate>00000000</HolderOffDate>
		<HolderAddedDate>01121994</HolderAddedDate>
	</RetrieveNameAndAddressRSResponse>
	<msg_holding_information>
		<return_status>0</return_status>
		<no_of_items>2</no_of_items>
		<items>
			<item id="1">
				<class>ORD</class>
				<balance>2000</balance>
				<available>2000</available>
			</item>
			<item id="2">
				<class>WAR</class>
				<balance>400</balance>
				<available>400</available>
			</item>
		</items>
	</msg_holding_information>
	<RetrieveClassInfoRSResponse>
		<return_status>0</return_status>
		<NoOfItems>6</NoOfItems>
		<Items>
			<Item id="1">
				<class_code>DMY</class_code>
				<description>SUBSCRIPTION WARRANTS 06-08-99</description>
				<flag1>N</flag1>
				<register_code>GBR</register_code>
				<flag2>W</flag2>
				<flag3>N</flag3>
				<flag4>N</flag4>
				<flag5>Y</flag5>
				<amount1>0</amount1>
			</Item>
			<Item id="2">
				<class_code>OMN</class_code>
				<description>ORD DRIP CARRIED FORWARD MONEY</description>
				<flag1>N</flag1>
				<register_code>*MR</register_code>
				<flag2>P</flag2>
				<flag3>N</flag3>
				<flag4>Y</flag4>
				<flag5>Y</flag5>
				<amount1>0</amount1>
			</Item>
			<Item id="3">
				<class_code>ORD</class_code>
				<description>ORDINARY SHARES OF 25P</description>
				<flag1>Y</flag1>
				<register_code>GBR</register_code>
				<flag2>S</flag2>
				<flag3>N</flag3>
				<flag4>N</flag4>
				<flag5>Y</flag5>
				<amount1>0</amount1>
			</Item>
			<Item id="4">
				<class_code>TOP</class_code>
				<description>TOP HOLDER'S CLASS</description>
				<flag1>Y</flag1>
				<register_code>GBR</register_code>
				<flag2>S</flag2>
				<flag3>N</flag3>
				<flag4>N</flag4>
				<flag5>Y</flag5>
				<amount1>0</amount1>
			</Item>
			<Item id="5">
				<class_code>TSS</class_code>
				<description>3.5% STERLING STOCK</description>
				<flag1>Y</flag1>
				<register_code>GBR</register_code>
				<flag2>D</flag2>
				<flag3>N</flag3>
				<flag4>N</flag4>
				<flag5>Y</flag5>
				<amount1>0</amount1>
			</Item>
			<Item id="6">
				<class_code>WAR</class_code>
				<description>WARRANTS</description>
				<flag1>Y</flag1>
				<register_code>GBR</register_code>
				<flag2>S</flag2>
				<flag3>N</flag3>
				<flag4>N</flag4>
				<flag5>Y</flag5>
				<amount1>0</amount1>
			</Item>
		</Items>
	</RetrieveClassInfoRSResponse>
</Shareholder_Summary>

================== XML =======================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
	<!--<xsl:output method="html"/>-->
	<!-- setting color values here, so can change easily -->
	<xsl:variable name="LightRow" select="'#FFCC66'"/>
	<xsl:variable name="DarkRow" select="'#FFEBBF'"/>
	<xsl:variable name="DisplayCell" select="'#000060'"/>
	<xsl:variable name="AmendCell" select="'#FF9700'"/>
	<xsl:template match="Shareholder_Summary">
		<html>
			<head>
				<title>Moorgate shareholder services</title>
			</head>
			<body bgcolor="#FFFFFF">
				<xsl:call-template name="PrintTable"/>
			</body>
		</html>
	</xsl:template>
	<xsl:template name="PrintTable">
		<table width="600" border="0" cellspacing="0" cellpadding="3">
			<tr bgcolor="#666666">
				<td width="45%"><font face="Arial, Helvetica, sans-serif"
color="#FFFFFF"><b><i>Shareholding
			Summary</i></b></font></td>
				<td width="45%"><br/></td>
				<td width="5%"><br/></td>
				<td width="5%"><br/></td>
			</tr>
			<!-- this is where we add the table rows -->
			<xsl:call-template name="GetTableData"/>
			<tr bgcolor="{$DisplayCell}">
				<td width="45%">
					<font face="Arial, Helvetica, sans-serif" size="2"
color="#FF9933"><b><i>Display
		      more information</i></b></font>
				</td>
				<td width="45%"><font face="Arial, Helvetica, sans-serif"
size="2"></font></td>
				<td width="5%"><br/></td>
				<td width="5%" bgcolor="{$AmendCell}">
					<br/></td>
			</tr>
			<tr bgcolor="{$AmendCell}">
				<td width="45%">
					<font face="Arial, Helvetica, sans-serif" size="2"><b><i><font
color="#000066">Amend
		      instructions or noting</font></i></b></font></td>
				<td width="45%"><font face="Arial, Helvetica, sans-serif"
size="2"></font></td>
				<td width="5%"><br/></td>
				<td width="5%"><br/></td>
			</tr>
		</table>
	</xsl:template>
	<xsl:template name="GetTableData">
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="1"/>
			<xsl:with-param name="DisplayText" select="'Holder Name:'"/>
			<xsl:with-param name="Value">
				<xsl:apply-templates
select="RetrieveNameAndAddressRSResponse/NameAddress1"/>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="2"/>
			<xsl:with-param name="DisplayText" select="'Holding In:'"/>
			<xsl:with-param name="Value"/>
		</xsl:call-template>
		<xsl:call-template name="PrintHoldingBalanceTable">
			<xsl:with-param name="MaxRecords"
select="msg_holding_information/no_of_items"/>
			<xsl:with-param name="ThisRecord" select="1"/>
		</xsl:call-template>
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="2"/>
			<xsl:with-param name="DisplayText" select="'Available Payment
History:'"/>
			<xsl:with-param name="Value"/>
		</xsl:call-template>
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="1"/>
			<xsl:with-param name="DisplayText" select="'Direct Credit
Instructions:'"/>
			<xsl:with-param name="Value">
				<xsl:apply-templates
select="RetrieveNameAndAddressRSResponse/HolderSystemPayeeFlag"/>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="2"/>
			<xsl:with-param name="DisplayText" select="'Dividend Reinvestment
Plan:'"/>
			<xsl:with-param name="Value">
				<xsl:apply-templates
select="RetrieveNameAndAddressRSResponse/HolderSystemDRPFlag"/>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="1"/>
			<xsl:with-param name="DisplayText" select="'Annual Report
Instructions:'"/>
			<xsl:with-param name="Value">
				<xsl:apply-templates
select="RetrieveNameAndAddressRSResponse/HolderStatusAnnualReport"/>
			</xsl:with-param>
		</xsl:call-template>
		<xsl:call-template name="PrintRows">
			<xsl:with-param name="RowColor" select="2"/>
			<xsl:with-param name="DisplayText" select="'Communication Details:'"/>
			<xsl:with-param name="Value"/>
		</xsl:call-template>
	</xsl:template>
	<xsl:template name="PrintHoldingBalanceTable">
		<xsl:param name="MaxRecords"/>
		<xsl:param name="ThisRecord"/>
		<xsl:choose>
			<xsl:when test="$ThisRecord &lt;= $MaxRecords">
				<xsl:choose>
					<xsl:when test="$ThisRecord = 1">
						<tr>
							<xsl:call-template name="GenerateRowColor">
								<xsl:with-param name="Index" select="1"/>
							</xsl:call-template>
							<td valign="top" width="45%" rowspan="{$MaxRecords}">
								<b><font face="Arial, Helvetica, sans-serif" size="2">Holding
Balance:</font></b>
							</td>
							<xsl:call-template name="GetHoldingBalanceData">
								<xsl:with-param name="Amount">
									<xsl:value-of select="msg_holding_information/items/item[@id =
$ThisRecord]/balance"/>
								</xsl:with-param>
								<xsl:with-param name="ClassCode">
									<xsl:value-of select="msg_holding_information/items/item[@id =
$ThisRecord]/class"/>
								</xsl:with-param>
							</xsl:call-template>
							<td width="5%" bgcolor="{$DisplayCell}"
rowspan="{$MaxRecords}"><br/></td>
							<td width="5%" bgcolor="{$AmendCell}"
rowspan="{$MaxRecords}"><br/></td>
						</tr>
					</xsl:when>
					<xsl:otherwise>
						<tr>
							<xsl:call-template name="GenerateRowColor">
								<xsl:with-param name="Index" select="1"/>
							</xsl:call-template>
							<xsl:call-template name="GetHoldingBalanceData">
								<xsl:with-param name="Amount">
									<xsl:value-of select="msg_holding_information/items/item[@id =
$ThisRecord]/balance"/>
								</xsl:with-param>
								<xsl:with-param name="ClassCode">
									<xsl:value-of select="msg_holding_information/items/item[@id =
$ThisRecord]/class"/>
								</xsl:with-param>
							</xsl:call-template>
						</tr>
					</xsl:otherwise>
				</xsl:choose>
				<xsl:call-template name="PrintHoldingBalanceTable">
					<xsl:with-param name="MaxRecords" select="$MaxRecords"/>
					<xsl:with-param name="ThisRecord" select="$ThisRecord + 1"/>
				</xsl:call-template>
			</xsl:when>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="GetHoldingBalanceData">
		<xsl:param name="Amount"/>
		<xsl:param name="ClassCode"/>
		<td>
			<font face="Arial, Helvetica, sans-serif" size="2">
				<xsl:value-of select="concat(format-number($Amount, '#,###'), ' ')"/>
				<xsl:call-template name="GetClassCodeDescription">
					<xsl:with-param name="ClassCode" select="$ClassCode"/>
				</xsl:call-template>
			</font></td>
	</xsl:template>
	<xsl:template name="GetClassCodeDescription">
		<xsl:param name="ClassCode"/>
		<xsl:apply-templates
select="RetrieveClassInfoRSResponse/Items/Item[class_code =
$ClassCode]/description"/>
	</xsl:template>
	<xsl:template name="PrintRows">
		<xsl:param name="RowColor"/>
		<xsl:param name="DisplayText"/>
		<xsl:param name="Value"/>
		<tr>
			<xsl:call-template name="GenerateRowColor">
				<!-- adds an xsl:attribute to the above TR -->
				<xsl:with-param name="Index" select="$RowColor"/>
			</xsl:call-template>
			<td valign="top" width="45%">
				<b><font face="Arial, Helvetica, sans-serif" size="2">
						<xsl:value-of select="$DisplayText"/>
					</font></b>
			</td>
			<td width="45%"><font face="Arial, Helvetica, sans-serif" size="2">
					<xsl:value-of select="$Value"/>
				</font></td>
			<td width="5%" bgcolor="{$DisplayCell}"><br/></td>
			<td width="5%" bgcolor="{$AmendCell}"><br/></td>
		</tr>
	</xsl:template>
	<xsl:template name="GenerateRowColor">
		<xsl:param name="Index"/>
		<xsl:choose>
			<xsl:when test="$Index mod 2">
				<xsl:attribute name="bgcolor">
					<xsl:value-of select="$LightRow"/>
				</xsl:attribute>
			</xsl:when>
			<xsl:otherwise>
				<xsl:attribute name="bgcolor">
					<xsl:value-of select="$DarkRow"/>
				</xsl:attribute>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

Sorry it's not a small email, but I can't do attachments.

Daniel.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread