| Subject: [xsl] empty attribute tags rendering in HTML From: "Bonnie Vasko" <bvasko@xxxxxxxxxxxxxxxx> Date: Mon, 27 Feb 2006 12:30:50 -0600 | 
Hello everyone,
I'm relatively new to XSL. I'm troubleshooting the templates created by
my former co-worker. They're outputting all the attributes for every
instance of every tag, even though they're empty, as in this example:
<td rowspan="2" colspan="" border="0" class=""><a id="" class=""
target="" title="" href="gateway.jsp" name=""><img id="" border="0"
alt="GuardMyHeart.com" class=""
src="images/headerLogo.gif"></a></td>
Here is a sample of the xsl:
<xsl:template match="a">
<a name="{@name}" href="{@href}" title="{@title}" target="{@target}"
class="{@class}" id="{@id}">
<xsl:value-of select="." /><xsl:apply-templates select="img" /></a>
</xsl:template>
<xsl:template match="td">
<td valign="{@valign}" align="{@align}" width="{@width}"></td>
</xsl:template>
<xsl:template match="img">
<img src="{@src}" class="{@class}" alt="{@alt}" border="0"
id="{@id}"></img>
</xsl:template>
I'm assuming there should be some kind of test that determines if the
attribute is empty, and if it is, don't write it. I haven't been able to
find an example of this. This is xml/xsl version 1. Thank you in
advance. Also, if you can point me to any resources that explain this, I
would really appreciate it.
Thanks,
Bonnie Vasko
Senior Developer
WHITTMANHART
main: 215.636.9500
fax: 215.636.9526
bvasko@xxxxxxxxxxxxxxxx
www.whittmanhart.com
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] selecting not(node()) not, Spencer Tickner | Thread | Re: [xsl] empty attribute tags rend, Spencer Tickner | 
| [xsl] selecting not(node()) not wor, Spencer Tickner | Date | RE: [xsl] Can't figure out why this, Bruso, John | 
| Month |