xsl-list
[Top] [All Lists]

empty attribute tags rendering in HTML

2006-02-27 11:30:50
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="{(_at_)name}" href="{(_at_)href}" title="{(_at_)title}" 
target="{(_at_)target}"
class="{(_at_)class}" id="{(_at_)id}">
<xsl:value-of select="." /><xsl:apply-templates select="img" /></a>
</xsl:template>

<xsl:template match="td">
<td valign="{(_at_)valign}" align="{(_at_)align}" width="{(_at_)width}"></td>
</xsl:template>

<xsl:template match="img">
<img src="{(_at_)src}" class="{(_at_)class}" alt="{(_at_)alt}" border="0"
id="{(_at_)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(_at_)whittmanhart(_dot_)com 
www.whittmanhart.com  



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>