xsl-list
[Top] [All Lists]

Re: constructing a "variable" select argument

2006-02-27 12:19:44
I am trying this, but not succeeding.

$question refers to an xml document which I am searching with these xpath selections.

this statement works:
<xsl:value-of select="$questions//Track[(_at_)id='T1']/MCP[(_at_)id='MC1']/ReportInstructions"/>


However, this does not:
after calling the template with
<xsl:with-param name="track" select="T1"/>

and using this in the template:

<xsl:param name="track"/>
<xsl:value-of select="$questions//Track[(_at_)id=$track]/MCP[(_at_)id='MC1']/ReportInstructions"/>



any ideas?

----- Original Message ----- From: "Joern Nettingsmeier" <nettings(_at_)folkwang-hochschule(_dot_)de>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Monday, February 27, 2006 11:30 AM
Subject: Re: [xsl] constructing a "variable" select argument


Tracey Zellmann wrote:
I have a stylesheet where I need to handle several different situations.
I want to make these selections, for instance

<xsl:value-of select="$questions//Track[(_at_)id='T1']/MCP[(_at_)id='MC1']/ReportInstructions"/> <xsl:value-of select="Report/TrackT1/Position[(_at_)position='Left Front']/MCHistogram[(_at_)id='1']/Average"/>

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


In different situations, the value T1 and MC1 change, to say T2 and MC2, and position might be Right Rear.

how about

<xsl:template name="parameterizedTemplate">
<xsl:param name="trackID"/>
<xsl:param name="mcpID"/>
<xsl:param name="position"/>
<xsl:value-of select="$questions//Track[(_at_)id=$trackID]/MCP[(_at_)id=$mcpID]/ReportInstructions"/> <xsl:value-of select="Report/TrackT1/Position[(_at_)position=$position]/MCHistogram[(_at_)id='1']/Average"/>
</xsl:template>

?

you can invoke this template with

<xsl:call-template name="parameterizedTemplate">
<xsl:with-param name="trackID" select="'T1'"/>
<xsl:with-param name="mcpID" select="'MC2'"/>
<xsl:with-param name="position" select="'Left Rear'"/>
</xsl:call-template>


hope that helps,

jörn



--
jörn nettingsmeier

home://germany/45128 essen/lortzingstr. 11/
http://spunk.dnsalias.org
phone://+49/201/491621

if you are a free (as in "free speech") software developer
and you happen to be travelling near my home, drop me a line
and come round for a free (as in "free beer") beer. :-D

--~------------------------------------------------------------------
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>
--~--





--~------------------------------------------------------------------
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>
--~--