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

Re: Processing CDATA


Subject: Re: Processing CDATA
From: "Kent Fitch" <kent.fitch@xxxxxxxxxxxx>
Date: Sun, 24 Jan 1999 14:47:52 +1100

From: Lars-Arne Mattsson <larssa@xxxxxxxxxx>
Sent: Sunday, January 24, 1999 3:19 AM
Subject: Processing CDATA


>How do I process character data containing some stylistic elements
>separate from other elements?
>....

I think this is an interesting question, and Im not sure how best
to do it, at least with the IE5 beta XSL Im using.  "or" 
conditions dont seem to work in the "match"  However, I
think this xsl prodcues what you want (with IE5 at least), although
it seems klutzy:  (Assumes your xml is wrapped in a 'document'
element)

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">

<xsl:template><xsl:value-of /></xsl:template>

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

<xsl:template match="document">
  <HTML>
    <HEAD>
           <TITLE>
        	test
        </TITLE>
    </HEAD>
      <BODY>
           <FORM>
            <TABLE>
        	 <xsl:apply-templates match="question" />
            </TABLE>
       </FORM>  
      </BODY>
 </HTML>
</xsl:template>

<xsl:template match="question">
  <TR>
       <TH>
               <xsl:for-each> 	
         	  <xsl:if match=".[nodeType()=3]">
        	    <xsl:apply-templates match="."/>	
        	  </xsl:if>	
        	  <xsl:if match=".[italic]">
                    <xsl:apply-templates match="."/>	
        	  </xsl:if>
        	  <xsl:if match=".[textNode()]">
        	    <xsl:apply-templates match="."/>	
        	  </xsl:if>	 
            </xsl:for-each>
       </TH>

       <xsl:apply-templates match="textanswer" />

  </TR>  
</xsl:template>

<xsl:template match="textanswer">
  <TR>
       <TD><TEXTAREA NAME="test">...</TEXTAREA></TD>
  </TR>
</xsl:template>

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

</xsl:stylesheet>

Kent Fitch                           Ph: +61 2 6276 6711
ITS  CSIRO  Canberra  Australia      kent.fitch@xxxxxxxxxxxx





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



Current Thread
Keywords