cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel Alfred" <Alfred.Nathan...@swx.com>
Subject RE: Newbie: Transformer chaining?
Date Thu, 04 Sep 2003 21:06:57 GMT
Not really a Cocoon question but here the template pair which 
does it for me (also preserving attributes on the input nodes):

  <xsl:template match="td">
    <td>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </td>
  </xsl:template>

  <xsl:template match="td[normalize-space()='' and count(*)=0]">
    <td>
      <xsl:apply-templates select="@*"/>
      <xsl:text>&#160;</xsl:text>
    </td>
  </xsl:template>

HTH, Alfred

> -----Original Message-----
> From: dbenoff@covad.net [mailto:dbenoff@covad.net]
> Sent: Donnerstag, 4. September 2003 22:42
> To: users@cocoon.apache.org
> Subject: Newbie: Transformer chaining?
> 
> 
> Hi all,
> 
> I am trying (without much luck), to implement a simple 2-step
> transformation.  The first step to provide the XSLT 
> transformation, the
> second is to look for empty table cells (<td></td>) and 
> insert a space in
> them.  Can any experienced Cocoon'ers explain how to do this?
> 
> Here's my sitemap setup:
>     <map:match pattern="*.dox">
>         <map:generate type="request" src="{1}" root-element="{1}"/>
>         <map:transform type="xslt" src="{1}.xsl" />
>         <map:transform type="xslt" src="tablefix.xsl" />
>         <map:serialize type="html" />
>     </map:match>
> 
> And here's the snippet I'm trying to use to do the table fix 
> (which just
> gives me a concatenated string of all element values):
> 
> <xsl:template match="td">
>     <td>
>         <xsl:choose>
>             <!-- If cell has child nodes or contains text 
> then output them
> -->
>             <xsl:when test="* or normalize-space()">
>                 <xsl:apply-templates/> 
>             </xsl:when>
>             <!-- Otherwise the cell is empty and we output a 
> non-breaking
> space -->
>             <xsl:otherwise>
>                 <xsl:text>&#160;</xsl:text>
>             </xsl:otherwise>
>         </xsl:choose>
>     </td>
> </xsl:template>
> 
> Thanks a bunch,
> David Benoff
> 
> 
> --------------------------------------------------------------------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
>

This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission.
If you receive this message in error, please notify the sender urgently
and then immediately delete the message and any copies of it from your
system. Please also immediately destroy any hardcopies of the message.
You must not, directly or indirectly, use, disclose, distribute, print,
or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail
communications through their networks. Any views expressed in this
message are those of the individual sender, except where the message
states otherwise and the sender is authorised to state them to be the
views of the sender's company. 



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message