Subject: [xsl] XSL variable out of scope From: Nischal Muthana <nischal_muthana@xxxxxxxxx> Date: Thu, 23 Jan 2003 12:03:39 -0800 (PST) |
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> </td><td> </td> <td nowrap="nowrap" colspan="2">   Home</td> <td nowrap="nowrap">"<xsl:value-of select="$HomePhone"/></td> </tr> <tr> <td> </td> <td> </td> <td nowrap="nowrap" colspan="2">   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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Script and XSL codes, Tham Tinh | Thread | RE: [xsl] XSL variable out of scope, Andy J. Cupp |
RE: [xsl] No-output identity templa, G. Ken Holman | Date | RE: [xsl] XSL variable out of scope, Andy J. Cupp |
Month |