xsl-list
[Top] [All Lists]

Re: constructing a "variable" select argument

2006-02-27 14:48:13
Tracey Zellmann wrote:

<xsl:copy-of select="/Report/TrackT1/Position[(_at_)position=
'Left Front']/MCHistogram[(_at_)id='1']/svg:svg"/>

The position and id attributes can change, and I can
handle that as in the earlier case.

However, the TrackT1 part of the expression can also
change - to TrackT2, TrackT3, Track5-18, etc, taking on
various values.

  You have different alternatives:

    <!-- A "global" variable by different case -->
    <xsl:variable name="track.T1" select="/Report/TrackT1"/>
    <xsl:variable name="track.T2" select="/Report/TrackT2"/>
    ...
      <xsl:with-param name="track" select="$track.T1"/>

    <!-- A template by different case -->
    <xsl:template name="...T1">
      ...
    <xsl:template name="...T2">
      ...

    <!-- In last resort... -->
    <xsl:template name="...">
      <xsl:param name="track" as="xs:string"/>
      <xsl:copy-of select="/Report/*[local-name()=$track]/..."/>

  And maybe other...  The choice depends on your particular
needs and contraints.

  Regards,

--drkm




















        

        
                
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs 
exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--