all groups > dotnet xml > august 2004 >
You're in the

dotnet xml

group:

Usage of // and $ in <xsl:value-of ...



Usage of // and $ in <xsl:value-of ... Aravind G via .NET 247
8/30/2004 6:58:05 AM
dotnet xml: (Type your message here)

--------------------------------
From: Aravind G

Hello all,

I have a peculiar situation.

Following is a small xml snippet in use

<ROOTNODE>
<SPSNODE>
<EXTERNALMESSAGE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<PHILIPSRIS>
<PERSON xmlns:dt="urn:schemas-microsoft-com:datatypes">
<PATIENT>
<SERVICEEPISODE>
<ORDERENTRY>
<ORDER_STATUS dt:dt="string">SC</ORDER_STATUS>
:
:
:

Through some mapping information I am able to get the element name (viz. ORDER_STATUS) in a variable say RISName.
The need is to get the Value of the element ORDER_STATUS. Since the element name is obtained dynamically, the exact path is not known during the program. Hence I am using the "//" expression suppported to reach the element of interst.

Below is the XSLT snippet used.

<xsl:variable name="RISValue">
<xsl:value-of select="//$RISName"/>
</xsl:variable>

XSLT processor is throwing "Not a valid XPath expression".

1. Can any one kindly clarify if // and $ can be used in conjunction?
2. If there is any way the needed solution can be arrived.

Thanks in advance

Regards
Aravind

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Re: Usage of // and $ in <xsl:value-of ... Oleg Tkachenko [MVP]
8/30/2004 5:10:00 PM
[quoted text, click to view]

You seems to be coding with macros too much :) No macros in XSLT. Use

<xsl:value-of select="//*[name() = $RISName]"/>

--
Oleg Tkachenko [XML MVP]
AddThis Social Bookmark Button