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

RE: Problems passing attributes

Subject: RE: Problems passing attributes
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Fri, 28 Sep 2001 14:34:08 +0100
passing attribute in xml
Doug,
The simple answer is <table border="$border;" should be <table
border="{$border}" .
But that won't solve it because this
<xsl:if test="@border=''">
 	<xsl:variable name="border">
 		"0"
 	</xsl:variable>
 </xsl:if>
 <xsl:if test="@border!=''">
 <xsl:variable name="border">
 	<xsl:value-of select="@border"/>
 </xsl:variable>
</xsl:if>
Won't work because by the time you come to use the variable border it is
out of scope. Use
<xsl:variable name="border">
  <xsl:if test="@border=''">0</xsl:if>
  <xsl:if test="@border!=''"><xsl:value-of select="@border"/></xsl:if>
</xsl:variable>
Instead

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Hewko, Doug
> Sent: 28 September 2001 14:02
> To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
> Subject:  Problems passing attributes 
> 
> 
> Can someone please tell me what am I doing wrong? I need to 
> create tables, so I am mimicing HTML's tables. I am having 
> problems passing the value of the "border" attribute to the 
> HTML equiivalent. In my HTML code, I see "<table border="$border">  "
> 
> Thanks.
> 
> XML:
> <table border="1">
> <tr>
> 	<td>Column</td>
> </tr>
> </table>
> 
> XSL:
> 
> <xsl:template match="table">
> <xsl:if test="@border=''">
> 	<xsl:variable name="border">
> 		"0"
> 	</xsl:variable>
> </xsl:if>
> <xsl:if test="@border!=''">
> <xsl:variable name="border">
> 	<xsl:value-of select="@border"/>
> </xsl:variable>
> </xsl:if>
> 
> <table border="$border;" cellspacing="0" cellpadding="0"> 
> <xsl:apply-templates /> </table> </xsl:template>
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
> 


 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.