This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Problems passing attributes


Thanks for the help!

Just wondering, could I have made life easier by referencing the XHTML
namespace, so my "<table border='0'>" elements are automatically processed?
If so, would it be as easy as referencing the XHTML namespace, or would
there be more to do?

And yes, this weekend I realized that in real life I should never use
<table>, etc elements but should try to stick more to a data rather than a
physical model. But HTML is a hard habit to break...

> -----Original Message-----
> From: Chris Bayes [mailto:chris@Bayes.co.uk]
> Sent: September 28, 2001 9:34 AM
> To: xsl-list@lists.mulberrytech.com
> Subject: RE: [xsl] Problems passing attributes 
> 
> 
> 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@lists.mulberrytech.com 
> > [mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of 
> > Hewko, Doug
> > Sent: 28 September 2001 14:02
> > To: 'xsl-list@lists.mulberrytech.com'
> > Subject: [xsl] 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
> 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]