RE: [xsl] testing 1st child

Subject: RE: [xsl] testing 1st child
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Fri, 6 Aug 2004 16:16:57 +0100
> I have some numbered steps that may have several children in any order
> but I only want to test the first child of the step
> 
> If it is a figure, warning, caution, or note do one thing if it is a
> title or a para do something else
> 
> I tried the following with mixed results
> 
> <xsl:when
> test="child::figure|child::table|child::warning|child::caution
> |child::no
> te">
>

<xsl:template match="step[*[1][self::figure|self::table...]]">
ONE THING
</xsl:template>

<xsl:template match="step[*[1][self::title|self::para...]]">
SOMETHING ELSE
</xsl:template>

Michael Kay



 
> Sample xml :
> 
> <step1>
> <note>
> <para>blah blah</para>
> </note>
> <para>xxxxx</para>
> </step1>
> 
> <step1>
> <warning><para>xjsdkfjsjfs;jfa</para></warning>
> <para>xxxxx</para>
> </step1>
> 
> <step1>
> <para>xxxxx</para>
> <figure><graphic/></figure>
> </step1>
> 
> <step1>
> <figure><graphic/></figure>
> <note>
> <para>blah blah</para>
> </note>
> <para>xxxxx</para>
> </step1>
> 
> 
> 
> Confidentiality Notice
> The information contained in this e-mail is confidential and 
> intended for use only by the person(s) or organization listed 
> in the address. If you have received this communication in 
> error, please contact the sender at O'Neil & Associates, 
> Inc., immediately. Any copying, dissemination, or 
> distribution of this communication, other than by the 
> intended recipient, is strictly prohibited.

Current Thread