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

RE: variable definition reuse

Subject: RE: variable definition reuse
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 22 Mar 2002 13:56:05 -0000
lable design
>
> <xsl:template match="//programme">
> <!-- VARIABLE DECLARATION -->
> <xsl:variable name = "color" select = "color">
> <xsl:variable name = "weight" select = "weight">
> <xsl:variable name = "cost" select = "cost">
> <xsl:variable name = "acceptance" select = "acceptance">
> <xsl:variable name = "mnf-date" select = "mnf-date">
> <xsl:variable name = "exp-date" select = "exp-date">
> <xsl:variable name = "lable-design" select = "lable-design">
> <xsl:variable name = "mkt-agncy" select = "mkt-agncy">
> <xsl:variable name = "serial-id" select = "serial-id">
> <xsl:variable name = "order-qty" select = "order-qty">
> <xsl:variable name = "re-order-level" select = "re-order-level">
> .<!-- VARIABLE DECLARATION ENDS -->
> .
> .-----   do some formating on these variables and display

> This block IS
> THE ONLY THING THAT CHANGES IN ALL THE 20 FILES )  ----------
> .
> </xsl:template>
> This block remains same in all the 20 files. Now what i
> wanted to do is that
> define these variables in a separate file so that all the 20
> XSL files can
> access/share these variables.

The only variables you can share across XSLT stylesheet modules are global
variables. Global variables have a single value that is constant for the
whole transformation. The variables above have a different value each time
the template rule is instantiated, because they are defined relatively to
the <programme> element.

As David pointed out, there is very little point defining these variables.
All it does is enable you to write $exp-date instead of exp-date, which
gives you neither an improvement in stylesheet legibility nor an improvement
in performance.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx


 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.