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

Re: [xsl] Check if next tag is ...


Subject: Re: [xsl] Check if next tag is ...
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Fri, 15 Dec 2006 09:54:05 +0100 (CET)

Anne Kootstra wrote:

  Hi

>  <C>
>    <P>DDD</P>
>    <T>EEE</T>
>    <S>FFF</S>
>  </C>
>  <C>
>    <P>GGG</P>
>    <S>HHH</S>
>  </C>
> </A>

> The end result I'm aiming for is a rather simpel HTML table:

>             P            T            S
> C        DDD       EEE       FFF
> C        GGG         *          HHH

  You can use something like this (but you didn't say if you are using
XSLT 1.0 or 2.0):

    <xsl:template match="C">
      <xsl:variable name="empty-t" as="element()">
        <T>*</T>
      </xsl:variable>
      <table-line>
        <xsl:apply-templates select="
            P, if ( T ) then T else $empty-t, S"/>
      </table-line>
    </xsl:template>

    <xsl:template match="P|T|S">
      <table-cell>
        <xsl:value-of select="."/>
      </table-cell>
    </xsl:template>

  Regards,

--drkm






















	

	
		
___________________________________________________________________________ 
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions ! 
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses 
http://fr.answers.yahoo.com


Current Thread
Keywords