Page 1 of 1

Unexpected token [$] in path expression

Posted: Thu Feb 26, 2009 1:21 pm
by droomdp
Hi,

I'm merging 2 XML files
and get in some trouble.

How can I do the following ?

<!-- path to second XML: PC.xml -->
<xsl:param name="PCRef" select="'PC.xml'"/>
<!-- -->
...
<xsl:attribute name="ValueToGet">
<!-- get value out of first XML -->
<xsl:variable name="myPC" select="Element1/Element2"/>
<!-- get value out of second XML based of the variable 'myPC'-->
<xsl:value-of select="document($PCRef)/El1/$myPC/@pc"/>
</xsl:attribute>

the variable $myPC is not accepted in the path expression.
I get the error: Unexpected token [$] in path expression.

How can I add a variable elementname in a path expression ?

Kind Regards,

Droom

Re: Unexpected token [$] in path expression

Posted: Thu Feb 26, 2009 3:36 pm
by droomdp
Hi,

Finaly I found the solution of my problem:

<xsl:value-of select="document($PCRef)//*[name(.)=$myGem]/@pc"/>


Regards,
Droom