Another option could be: run the output XML through another transform which would eliminate empty attributes.
- Ruchikar. --- Xan Gregg <[EMAIL PROTECTED]> wrote: > Try using a template for each attribute: > > <xsl:template match = "table"> > <table> > <xsl:apply-templates select = "@width"/> > <xsl:apply-templates select = "@height"/> > ... > </table> > </xsl:template> > > <xsl:template match = "@width"> > <xsl:attribute name = "width"> > <xsl:value-of select = "."/> > </xsl:attribute> > </xsl:template> > ... > > xan > > -----Original Message----- > From: "Kazm�r, Jaroslav" > [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 15, 2002 11:17 AM > To: '[EMAIL PROTECTED]' > Subject: XSL - blank attribute > > > Hello, > I have a XSL stylesheet like this: > > ... > <xsl:template match="table"> > <table> > <xsl:attribute name="width"> > <xsl:value-of select="@width" /> > </xsl:attribute> > > <xsl:attribute name="height"> > <xsl:value-of select="@height" /> > </xsl:attribute> > > <xsl:attribute name="cellspacing"> > <xsl:value-of select="@cellspacing" /> > </xsl:attribute> > > <xsl:attribute name="cellpadding"> > <xsl:value-of select="@cellpadding" /> > </xsl:attribute> > > <xsl:attribute name="bordercolor"> > <xsl:value-of select="@bordercolor" /> > </xsl:attribute> > > <xsl:attribute name="class"> > <xsl:value-of select="@class" /> > </xsl:attribute> > > <xsl:for-each select="row"> > <tr> > <xsl:attribute name="bgcolor"> > <xsl:value-of select="@bgcolor" > /> > </xsl:attribute> > > <xsl:for-each select="data"> > <td> > <xsl:attribute name="valign"> > <xsl:value-of > select="@valign" /> > </xsl:attribute> > > <xsl:attribute name="class"> > <xsl:value-of > select="normalize-space(@class) " /> > </xsl:attribute> > > <xsl:attribute name="height"> > <xsl:value-of > select="@height" /> > </xsl:attribute> > > <xsl:attribute name="width"> > <xsl:value-of > select="@width" /> > </xsl:attribute> > > <xsl:apply-templates /> > </td> > </xsl:for-each> > </tr> > </xsl:for-each> > </table> > </xsl:template> > ... > My problem is, that the output looks like with empty > attributes: > > <table .. height="" width="" ...> > <tr ...bgcolor=""> > <td valign="center" class=""> > .... Some text ... > </td> > <tr> > <table> > > Do you anyone know how could I erase all emty > attributes in the output? I > don't want to write conditions into XSL file for > every attibute. > Output will be better to see like: > > <table> > <tr> > <td valign="center"> > ... Some text ... > </td> > <tr> > </table> > > Thanx a lot for your help and advice. > > JayKay > > ---------------------------------------------------------------------------- > ----------------- > Jaroslav Kazmir > Institute of Information Systems & Information > Management > JOANNEUM RESEARCH Forschungsgesellschaft mbH > Steyrergasse 17, A-8010 Graz, AUSTRIA > > phone: +43-316-876-1140 fax: > +43-316-876-1191 > web: http://iis.joanneum.at > <http://iis.joanneum.at> > e-mail: mailto:[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]> > ---------------------------------------------------------------------------- > ----------------- > > __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com --------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
