[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Paramters in templates

Subject: Re: Paramters in templates
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 23 Jul 1999 09:06:27 +0100 (BST)
xsl paramters
> In the style sheet I'm working on I having to add the param support in
> hundreds of places to make sure it keeps getting passed down. This has
> doubled the size of my stylesheet and made it hard to read.


If carying the information down the tree is too much effort, it may be
simpler to leave it at the top, and just send back for it when you need
it.

ie rather than

<xsl:template match="A">
<xsl:apply-templates>
  <xsl:param name="label" expr="true"/>
</xsl:apply-templates>
<xsl:template>


<xsl:template match="B">
<xsl:apply-templates>
  <xsl:param name="label" expr="false"/>
</xsl:apply-templates>
<xsl:template>

and then all templates explicitly handling a parameter $label,
you can do

<xsl:template match="A|B">
<xsl:apply-templates/>
<xsl:template>


and then, when in the first version you actually used $label, rather
than just passing it on, now  go

  <xsl:if test="from-ancestors-or-self(A)">
   


David


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.