RE: [xsl] <xsl:test="">

Subject: RE: [xsl] <xsl:test="">
From: Phillip Nicolson <pjn3@xxxxxxxxxxxxx>
Date: 16 Sep 2004 13:02:54 +0100
Thanks all,

this really is a useful list and much appreciated!

On Thu, 2004-09-16 at 12:03, Michael Kay wrote:
> Use 
> 
> <xsl:apply-templates mode="x" select="."/> 
> 
> <xsl:template mode="x" match="forObj | flow | step">
> 
> Doing an explicit test on name() should only be a last resort: template
> rules are there for this job. 
> 
> Note that you can give the same template both a name and a match pattern if
> you need to, and invoke it either by apply-templates or by call-template.
> 
> You could write (name()='forObj' or name()='flow'...), and in XSLT 2.0 you
> could write <xsl:if test="name() = ('forObj', 'flow', 'step')"> but it's not
> the right answer here.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 
> > -----Original Message-----
> > From: Phillip Nicolson [mailto:pjn3@xxxxxxxxxxxxx] 
> > Sent: 16 September 2004 10:58
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] <xsl:test="">
> > 
> > I have a stylesheet containing a number of <xsl:test> statements. 
> > 
> > Rather than having:
> > 
> > <xsl:if test="name() = 'forObj'">...........call template
> > <xsl:if test="name() = 'flow'">............call template
> > <xsl:if test="name() = 'step'">............call template
> > ....etc 
> > 
> > all of which call the same template is it possible to test if name() =
> > forObj OR flow OR step etc in one statement?
> > 
> > Many thanks for suggestions
> >  
> > -- 
> > Phillip Nicolson			
> > Department of Physics & Astronomy		Phone:	(0)116 2523581
> > University of Leicester				Email:	
> > pjn3@xxxxxxxxxxxxx
> > Leicester        LE1 7RH			Web:	
> > http://www.astrogrid.org
> 
-- 
Phillip Nicolson			
Department of Physics & Astronomy		Phone:	(0)116 2523581
University of Leicester				Email:	pjn3@xxxxxxxxxxxxx
Leicester        LE1 7RH			Web:	http://www.astrogrid.org

Current Thread