<xsl:variable name="IoHwAbstractionFileName" select="'../xml/IoHwAbstraction.xml'"/>
<xsl:variable name="IoHwAbstraction" select="document($IoHwAbstractionFileName)"/>


<xsl:template match="/">
<xsl:variable name="xpath" select="/AUTOSAR/IoHwAbstraction/IoHwAbEcuSignals[2]/IoHwAbDiscreteOutput[1]/../../ShortName"/>

result 1 ok : <xsl:value-of select="$IoHwAbstraction/AUTOSAR/IoHwAbstraction/IoHwAbEcuSignals[2]/IoHwAbDiscreteOutput[1]/../../ShortName"/>

result 2 : <xsl:value-of  select="$IoHwAbstraction/$xpath]"/>

This fails because of the square bracket. If you removed that, it would be valid and would execute, but would not give a useful result: the value of $xpath is a node-set, and the result of $A/$B when $B is a node-set is simply $B. If you changed it so that $xpath was a string containing the XPath expression (by adding an inner set of quotes to the select attribute), it would again be valid and would again not do what you want, because the result of $A/$B when $B is a string is simply the value of $B.

result 3 : <xsl:value-of  select="saxon:evaluate(concat($IoHwAbstraction,'$xpath'))"/>

The value of $IoHwAbstraction is a document node, so if you use it as an argument to concat(), it will be atomized. Using the string value of the document node is not going to be very useful.

result 4 : <xsl:value-of  select="saxon:evaluate(concat($IoHwAbstraction,'/AUTOSAR/IoHwAbstraction/IoHwAbEcuSignals[2]/IoHwAbDiscreteOutput[1]/../../ShortName'))"/>

Same problem here.

What you want is this:

<xsl:variable name="xpath" select="'/AUTOSAR/IoHwAbstraction/IoHwAbEcuSignals[2]/IoHwAbDiscreteOutput[1]/../../ShortName'"/>

(note the extra quotes), and then

<xsl:value-of select="$IoHwAbstraction/saxon:evaluate($xpath)"/>

This evaluates the XPath expression contained in the string $xpath with the node in $IoHwAbstraction as the context node.

Michael Kay
Saxonica



</xsl:template>
</xsl:styleshee

Thank you for your support
Philippe
------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help