xsl-list
[Top] [All Lists]

RE: empty attribute tags rendering in HTML

2006-02-27 11:47:44
They're outputting all the attributes for every
instance of every tag, even though they're empty, as in this example:

<a name="{(_at_)name}" href="{(_at_)href}" title="{(_at_)title}" 
target="{(_at_)target}"
class="{(_at_)class}" id="{(_at_)id}">

Change this to:

<a>
  <xsl:copy-of select="@*"/>

or if you want to be more specific

<a>
  <xsl:copy-of select="@name|@href|@title|@target|@class|@id"/>

A node that isn't present won't be selected and won't therefore be copied.

Michael Kay
http://www.saxonica.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>