cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Benoff" <dben...@covad.net>
Subject RE: Newbie: Transformer chaining?
Date Fri, 05 Sep 2003 14:14:37 GMT
Thanks for taking a stab at this Nathaniel, I appreciate it.  Let me
rephrase the question a bit, however, since the table problem was really
more of an example.  What I'm really trying to get at is to know whether
it is possible to manipulate the contents of a document within a
pipeline AFTER it has been transformed into(x)html.  

My design problem is that I have a webapp where to selectively control
whether various html form fields are editable or greyed-out based on
request parameters.  What I'd ideally like to do is have my initial
transformation apply the first stylesheet, producing a xhtml document,
THEN apply a second stylesheet, which will look for form fields in the
xhtml and set read/write permissions on them based on request
parameters, and only then serialize the output.  Is this possible?  Any
hints on how to approach this?

Thanks very much,
David Benoff

-----Original Message-----
From: Nathaniel Alfred [mailto:Alfred.Nathaniel@swx.com] 
Sent: Thursday, September 04, 2003 2:07 PM
To: users@cocoon.apache.org
Subject: RE: Newbie: Transformer chaining?

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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
 


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


Mime
View raw message