[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: Processing CDATA


Subject: Re: Processing CDATA
From: James Clark <jjc@xxxxxxxxxx>
Date: Sun, 24 Jan 1999 08:35:53 +0700

Probably the easiest way is to use a mode:

<xsl:template match="question">
  <tr><xsl:apply-templates/></tr>
  <tr><xsl:apply-templates select="textanswer" mode="answer"/></tr>
</xsl:template>

<xsl:template mode="answer" match="textanswer">
 <td><textarea name="test" ...></textarea></td>
</xsl:template>

<xsl:template match="textanswer"/><!-- ignore except in answer mode -->

<xsl:template match="italic">
  <i><xsl:apply-templates/></i>
</xsl:template>

Lars-Arne Mattsson wrote:
> 
> Hello!
> 
> How do I process character data containing some stylistic elements
> separate from other elements?
> 
> I want to do the following:
> XML:
> <question>
>    Tell me what you <italic>think</italic> of this program?
>    <textanswer/>
> </question>
> 
> HTML:
> <form ...>
> <table>
> ...
>   <tr>
>     <th>Tell me what you <i>think</i> of this program?</th>
>   </tr>
>   <tr>
>     <td><textarea name="test" ...></textarea>
>   </tr>
> ...
> </table>
> </form>
> 
> The problem is how I should extract the question text together with
> the the <italic> element and still be able to handle <textanswer>
> separately. <xsl:process-children/> won't work and I haven't succeded
> to create a <xsl:process select=""> that works.
> 
> I would really appreciate some help!
> 
> Greetings,
> /Larssa
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread