473,806 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

(Type your message here)

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

Hello all,

I have a peculiar situation.

Following is a small xml snippet in use

<ROOTNODE>
<SPSNODE>
<EXTERNALMESSAG E xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance">
<PHILIPSRIS>
<PERSON xmlns:dt="urn:s chemas-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/)

<Id>wGuVymWsVkO Nt/Jdz+2Tsw==</Id>
Nov 12 '05 #1
1 1279
Aravind G via .NET 247 wrote:
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>


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

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

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1806
by: Miguel J. Jiménez | last post by:
Hi, I need to make a FOR structure using XSL... ie. I want to make a structure for moving between 0 and x, being x a variable name... How can I do this? In PHP/Java would be something like this: for($i=0;$i<LIMIT;$i++) { // Something using $i }
4
1815
by: Figo 775 | last post by:
Hi, I have an xml document which is as below: <?xml version="1.0" encoding="UTF-8"?> <fragment name="htmlPart"> <value>&lt;table&gt; &lt;tr&gt;&lt;td&gt;&lt;b&gt;Feature&lt;/b&gt;&lt;/td&gt;&lt;td&gt;&lt;b &gt;Benefit&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;some sample text runs here&lt;/td&gt;&lt;td&gt;some sample text runs here too&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;some sample text runs here&lt;/td&gt;&lt;td&gt;some
0
1299
by: kirashet | last post by:
Hello everybody, I tried to make a XSL:FO - Sheet where I can control if the PDF should be printed in portrait or landscape. My results so far: <xsl:param name="printingtype" select="'landscape'"> <xsl:variable name="pageheight"> <xsl:choose> <xsl:when
1
1379
by: Slav | last post by:
Hi, I trying to process an XML file using a XSL but am getting a Sablotron error ("...mismatched tag") when I entered an accented letter such as "é". I tried to play around with the encoding and am currently using UTF-8. When I process my XML file using XMLSpy the ouput is fine (the é letter is properly displayed), which leads me to believe that there is nothing wrong with my XML file strcuture.
4
3725
by: Invalidlastname | last post by:
Hi, I have an XML document, created from ADO DataSet, which contains XML data in some nodes shown below: <NewDataSet> <Table> <field_name>My Selection</field_name> <field_type>dropdown</field_type> <field_choice_text>
4
1818
by: dwa | last post by:
Is it legal to use a parameter in a <template match> ? If I do the following: <xsl:template match="/ContentRoot/Content/Categories/Category"> ....everything works as expected. But if I do the following: <xsl:template
4
1896
by: Jim Garrison | last post by:
OxygenXML is rejecting the following usage with "Unknown system function: if" <xsl:variable name="qd" select="if(value/qDisplay/text() eq '') then 'empty' else 'right'"/> Is this syntactically correct? If not, how should it read?
8
4469
by: Larry | last post by:
Hi, I'm trying to get the following working but I'm at a loss and dont know what is wrong with it: <div class="name"> <a href=" <xsl:apply-templates select="key" mode="getValue" /" target="_blank"> <xsl:apply-templates select="key" mode="getValue" /> <xsl:text> </xsl:text>
8
22981
by: ajc308 | last post by:
I am using C# to transform an XML document which actually outputs another XML document using XslCompiledTransform and an XmlTextWriter. The code I am using is: XslCompiledTransform myXslTrans = new XslCompiledTransform(); myXslTrans.Load("sortByExtension.xsl"); XmlTextWriter myWriter = new XmlTextWriter("result.xml", null); myXslTrans.Transform(tvXML, null, myWriter); myWriter.Close();
2
2207
by: njsimha | last post by:
Hi, In the following XML snippet,the output has to select all the <template1>tags whose <subelem1> value is > 50 and <100 <root> <template1> <elem1>
0
10364
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10370
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5545
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3849
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.