473,506 Members | 16,994 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[xsl] treat attribute value as xpath expression


I have xml like this:

<data>
<binding nodeset="/data/set1/value[@name='a']"/>
<set1>
<value name="a" value="3"/>
</set1>
</data>
is it possible with an xsl styelsheet to do something like this

<xsl:template match="binding">
<xsl:variable name="bounded-nodeset"
value="eval-xpath(./binding/@nodeset)"/>

</xsl:template>

Hope you understand what i mean.
Dec 22 '05 #1
2 1448


Tjerk Wolterink wrote:
is it possible with an xsl styelsheet to do something like this

<xsl:template match="binding">
<xsl:variable name="bounded-nodeset"
value="eval-xpath(./binding/@nodeset)"/>


Certainly not in XPath 1.0 as specified as a W3C recommendation. But
some processors provide extension functions for that, for example Saxon
6.5 has
<http://saxon.sourceforge.net/saxon6.5.5/extensions.html#evaluate>

EXSLT also has
<http://www.exslt.org/dyn/functions/evaluate/index.html> and lists
Xalan-Java, 4XSLT, and libxslt as supporting that.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 23 '05 #2
Martin Honnen wrote:
Tjerk Wolterink wrote:
<xsl:template match="binding">
<xsl:variable name="bounded-nodeset"
value="eval-xpath(./binding/@nodeset)"/>

Certainly not in XPath 1.0 as specified as a W3C recommendation. But
some processors provide extension functions for that


A two-passes transformation can help, in some cases. The first pass
create a new stylesheet containing the XPath expression. The second
pass executes the created stylesheet.

--drkm

Dec 24 '05 #3

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

Similar topics

3
7185
by: Rupa | last post by:
Hi, I'm trying to write an xslt to convert an email in xml format to a new xml format. <descr> <xsl:choose> <xsl:value-of select="body"> </xsl:value-of select> <xsl:when test=" <xsl:value-of...
2
8692
by: Robert Kattke | last post by:
I'm getting a TransformerException when running Tomcat and calling a Servlet that use XML to create DOM and XSL to create webpage. I'm posting just the snippet of XSL code and the Error here. ...
14
12123
by: inquirydog | last post by:
Hi- One frusterating thing for me with xsl is that I don't know how to make xslt throw some sort of exception when a value-of path does not exist. For instance, suppose I have the following...
1
5445
by: kurt hansen | last post by:
hi I thought that this would be easy, but maybe not so much. I want to: pass an xpath expression and a string value to a stylesheet and copy the source xml document, changing the value of...
4
1528
by: Tjerk Wolterink | last post by:
I've xml code like this: roles.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <roles xmlns="http://www.wolterinkwebdesign.com/xml/roles"> <!-- ! The admin role. ! And admin should have...
2
1569
by: Marc Scheuner [MVP ADSI] | last post by:
Folks, I'm trying to get something done in XSL and either I'm just missing some silly thing, or it's not possible to do it.... which is it??? What I'm trying to do is have a XML document that...
2
1876
by: Alistair Bayley | last post by:
(.Net framework version 1.1.4322) The following XSL test case is rejected by System.Xml.Xsl.XslTransform, with an XsltException: "($dummy)+0 is an invalid XPath expression." If you remove the...
2
1102
by: Jerry Langley | last post by:
I have an xml document containing properties for a group of hyperlinks. Currently my xsl:stylesheet contains code as follows: <a href="{concat(/links/@webroot,@url)}" title="My ToolTip Here">...
9
1789
by: shakilalig | last post by:
Hi All, I am writing an XSL to transform the XML to XML.Only change i need in xml is to add the value for the price element under book tag for which publisher location is "World". The...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7021
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...
0
7478
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...
0
5614
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,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4701
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...
0
3188
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...
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.