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

Re: [xsl] alternative for modes


Subject: Re: [xsl] alternative for modes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 12 Feb 2004 10:35:11 GMT

  Imagine this function can be called on a tag <root> and <child> is a child
  of that tag. So each time when 'generalTemplate' is called, a template which
  matches the tag 'child' will be called too:


OK, although xslt can't see any tags in the document, and tags dont have
children (and tags are not the same thing as elements)

< xsl:template match="child">
	<xsl:if test="$p = 'situation1'>

If situation is deducable from the context of the child element node
then a common idiom is to have

 <xsl:template match="foo/child">...
 <xsl:template match="bar/child">...
 <xsl:template match="child[x=y]" priority="2">...

and then you just need 
<xsl:apply-templates/>
in your calling template.

David


-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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



Current Thread
Keywords