RE: [xsl] empty attribute tags rendering in HTML

Subject: RE: [xsl] empty attribute tags rendering in HTML
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 27 Feb 2006 18:47:44 -0000
> They're outputting all the attributes for every
> instance of every tag, even though they're empty, as in this example:
> 
> <a name="{@name}" href="{@href}" title="{@title}" target="{@target}"
> class="{@class}" id="{@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/

Current Thread