Subject: RE: [xsl] variable definition reuse From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Fri, 22 Mar 2002 13:56:05 -0000 |
> > <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] variable definition reuse, David Carlisle | Thread | Re: [xsl] variable definition reuse, Jeni Tennison |
[xsl] problem with loadXML method, didi didi | Date | [xsl] FOP - what, where, when, how?, Alastair Growcott |
Month |