| Subject: Re: testing the current node in IF statements From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Fri, 04 Feb 2000 11:11:56 +0000 | 
At 02:01 PM 2/4/00 -0000, Peter Bennet wrote: >what I really want to do now is use the same idea for the node itself >i.e.. > ><xsl:template match="book | chapter"> > <xsl:if test="self='book'"> > instructions > </xsl:if> > <xsl:if test="self='chapter'"> > different instructions > </xsl:if> > some instructions common to both ></xsl:template> >... Well, a way to do what you want would be to resort to string testing against the nefarious local-name(), as in: <xsl:template match="book | chapter"> <xsl:if test="local-name()='book'"> instructions </xsl:if> <xsl:if test="local-name()='chapter'"> different instructions </xsl:if> some instructions common to both </xsl:template> But a better way to achieve the same result might be to split your logic into separate templates after all: <xsl:template name="common-instructions"> some instructions common to both </xsl:template> <xsl:template match="book"> book instructions <xsl:call-template name="common-instructions"/> </xsl:template> <xsl:template match="chapter"> chapter instructions <xsl:call-template name="common-instructions"/> </xsl:template> Have fun-- Wendell Piez ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: How can I get the position of a, senthil | Thread | testing the current node in IF stat, Peter Bennett | 
| RE: How to build a frames using XSL, Sebastian Rahtz | Date | RE: How to build a frames using XSL, Nilay . Shah | 
| Month |