[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XSL variable out of scope

Subject: XSL variable out of scope
From: Nischal Muthana <nischal_muthana@xxxxxxxxx>
Date: Thu, 23 Jan 2003 12:03:39 -0800 (PST)
xsl nowrap
Hi All,

I have an xml and xsl like the following. When I apply
the xsl I need to get the following HTML

Home: 4089888888
Business: 40888888

But I get an error saying variable out of scope. And I
know I am using a variable declared in a different
scope. I am kinda stuck here and I dont have any more
ideas to counter this. Can someone help me find a way
to tackle this problem. 

PhoneList.xml

<?xml-stylesheet type="text/xsl"
href="C:\TestXSLT\xsl\PhoneList.xsl"?>
<PhoneList>
	<Phone>
		<PhoneUseCode>BUS</PhoneUseCode>
		<PhoneNumber>4082389033</PhoneNumber>
	</Phone>
	<Phone>
		<PhoneUseCode>HOME</PhoneUseCode>
		<PhoneNumber>4082834798</PhoneNumber>
	</Phone>
</PhoneList>


PhoneList.xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<xsl:for-each select="//PhoneList/Phone">
	<xsl:variable name="PhUseCode"
select="PhoneUseCode"/>
	<xsl:choose>
		<xsl:when test="$PhUseCode='HOME'">
<xsl:variable name="HomePhone" select="PhoneNumber"/>
	</xsl:when>
	<xsl:when test="$PhUseCode='BUS'">
<xsl:variable name="BusPhone" select="PhoneNumber"/>
	</xsl:when>
</xsl:choose>
</xsl:for-each>
<tr>
	<td>&#160;</td><td>&#160;</td>
	<td nowrap="nowrap"
colspan="2">&#160;&#160;&#160;Home</td>
				<td nowrap="nowrap">"<xsl:value-of
select="$HomePhone"/></td>
			</tr>
			<tr>
				<td>&#160;</td>
				<td>&#160;</td>
				<td nowrap="nowrap"
colspan="2">&#160;&#160;&#160;Business</td>
				<td nowrap="nowrap"><xsl:value-of
select="$BusPhone"/></td>
			</tr>
	</xsl:template>
</xsl:stylesheet>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.