You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by "Kazmír, Jaroslav" <ja...@joanneum.at> on 2002/11/15 17:16:48 UTC
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:jaroslav.kazmir@joanneum.at
<ma...@joanneum.at>
----------------------------------------------------------------------------
-----------------