[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] Params being intialised with variables based on attributes
Subject: Re: [xsl] Params being intialised with variables based on attributes From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Wed, 26 Jun 2002 15:53:16 +0100 |
Hi Gary, > I have many when test's to reference global variables in my code and > I can't seem to find a way of optimising the code so I am wondering > if someone can help. One possibility would be to use a single variable holding an XML structure rather than several variables holding individual values. For example, you could have $column-numbers-rtf holding a result tree fragment with elements whose names reflect the columns: <xsl:variable name="column-numbers-rtf"> <avgroup>1</avgroup> <gallery>2</gallery> <free>3</free> ... </xsl:variable> and then have $column-numbers hold the elements with either: <xsl:variable name="column-numbers" select="exsl:node-set($column-numbers-rtf)/*" /> or: <xsl:variable name="column-numbers" select="document('')/xsl:variable[@name = 'column-numbers-rtf']/*" /> Then your parameter can simply get the value of the element in $column-numbers whose name is the same as the value of the grouping attribute of the mediaobject element: <xsl:template match="mediaobject"> <xsl:param name="column-number" select="$column-numbers[name() = current()/@grouping]" /> ... </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Params being intialised with , gary cor | Thread | [xsl] A method to insert Adobe's ac, Toni Geoly |
Re: [xsl] How to throw transformati, David Carlisle | Date | [xsl] Re: Semantics of xsl:key, Bill Cohagan |
Month |
Keywords