xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruchikar Dalela <ruchikardal...@yahoo.com>
Subject RE: XSL - blank attribute
Date Tue, 19 Nov 2002 05:33:53 GMT
Another option could be: run the output XML through
another transform which would eliminate empty
attributes.


- Ruchikar.


--- Xan Gregg <xan@tibco.com> 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:jaroslav.kazmir@joanneum.at]
> Sent: Friday, November 15, 2002 11:17 AM
> To: 'general@xml.apache.org'
> 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:jaroslav.kazmir@joanneum.at
> <mailto:jaroslav.kazmir@joanneum.at> 
>
----------------------------------------------------------------------------
> -----------------
>  
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message