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

RE: [xsl] alternative for modes


Subject: RE: [xsl] alternative for modes
From: "Peter Billen" <peter@xxxxxxxxxxx>
Date: Thu, 12 Feb 2004 11:47:24 +0100

Oops sorry for my mixing up between tags and elements, still new to XSLT :)

I did not meant it that way: imagine you have to parse a certain node 'x' (+
his children) more than 1 time in a stylesheet: each time the parsing of 'x'
is exactly the same, but the parsing of 'x''s children is different. So for
each time I should call the same template for 'x', but that template should
call a different template for his children.

Peter

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of David Carlisle
Sent: donderdag 12 februari 2004 11:35
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] alternative for modes

  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


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



Current Thread
Keywords