[xsl] Params being intialised with variables based on attributes

Subject: [xsl] Params being intialised with variables based on attributes
From: "gary cor" <stuff4gary@xxxxxxxxxxx>
Date: Wed, 26 Jun 2002 14:16:19 +0000
Hi,

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.

For instance have some parameters in templates that are initialised with big statements like follows-


<xsl:template match=mediaobject ... <xsl:param name="column-number"> <xsl:choose> <xsl:when test="@grouping='avgroup'"> <!-- This is a global variable --> <xsl:value-of select="$avgroup-column-number"/> </xsl:when> <xsl:when test="@grouping='gallery'"> <xsl:value-of select="$gallery-column-number"/> </xsl:when> <xsl:when test="@grouping='free'"> <xsl:value-of select="$free-column-number"/> </xsl:when> <xsl:when test="@grouping='inline'"> <xsl:value-of select="$inline-column-number"/> </xsl:when> <xsl:when test="@grouping='list'"> <xsl:value-of select="$list-column-number"/> </xsl:when> <xsl:when test="@grouping='person'"> <xsl:value-of select="$person-column-number"/> </xsl:when> <xsl:when test="@grouping='wallpaper'"> <xsl:value-of select="$wallpaper-column-number"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="$mediaobject-column-number"/> </xsl:otherwise> </xsl:choose> </xsl:param>

I suppose I sort of want to do something like...

<xsl:value-of select="${@grouping}-column-number"/>

but I know this isn't legal XSLT

Any ideas?

Cheers G.


_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com



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



Current Thread