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

empty attribute tags rendering in HTML

Subject: empty attribute tags rendering in HTML
From: "Bonnie Vasko" <bvasko@xxxxxxxxxxxxxxxx>
Date: Mon, 27 Feb 2006 12:30:50 -0600
bonnie vasko
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

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-2007 All Rights Reserved.