Re: Feature Request: OtherNodeExpr: SelfExpr

Subject: Re: Feature Request: OtherNodeExpr: SelfExpr
From: James Clark <jjc@xxxxxxxxxx>
Date: Thu, 14 Jan 1999 10:47:13 +0700
"G. Ken Holman" wrote:
> 
> I can't see from production [11] how I would write a test= value checking
> for a particular node.
> 
> Consider:
> 
>    <xsl:for-each select="thing1|thing2">
>      <xsl:choose>
>        <xsl:when test="{what goes here to test for thing1?}">
>          ...processing for a thing1 element...
>        </xsl:when>
>        <xsl:otherwise>
>          ...processing for a thing2 element...
>        </xsl:otherwise>
>      </xsl:choose>
>    </xsl:for-each>

Use templates and modes:

<xsl:template match="...">
  ...
  <xsl:apply-templates select="thing1|thing2" mode="thing"/>
  ...
</xsl:template>

<xsl:template match="thing1" mode="thing">
...processing for thing1
</xsl:template>

<xsl:template match="thing2" mode="thing">
...processing for thing2
</xsl:template>

James



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


Current Thread