473,795 Members | 2,919 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 1465


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.sourcefor ge.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
7227
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 select="body/size_in_chars"> > 1042"></xsl:when> <xsl:otherwise> SOMETHING HERE THAT I HAVEN'T SORTED OUT YET
2
8715
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. Full listing should be in my next thread. Funny thing is from a command line I can run Process without an error. Why would Tomcat hiccup and belch ? Maybe I should be investigating my JARs in the classpath ? *** note error occurring in ln 65 ***
14
12194
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 line in xslt <xsl:value-of select="/blah/q" /> and my xml document does not have a node /blah/q. The output would
1
5483
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 the node described by the xpath expression, to the new value.
4
1553
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 all permisions to do its task !
2
1584
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 (to some degree) describes a report - basically, it's a collection of labels and XPath references of where in the XML document to find the values for those labels. Seems pretty simple and straightforward, and looks something like this:
2
1890
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 parentheses then it is happy. This appears to be an error; see http://www.w3.org/TR/xpath#NT-Expr. The path through the grammar is quite long; if you start with the Expr rule, it (eventually) leads back to PrimaryExpr, which indicates that ($variable) is...
2
1109
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"> <xsl:value-of select="@name"/></a> I want to replace "My ToolTip Here" with the contents of the @description element. I have not been able to get the syntax right. Please help.
9
1805
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 value for the price tag should be the sum of the value of price tag of two book tags (location for one is US and location of other is India). here is the snippets from the code: book.xml ---------------------------------------------------
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10165
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
10002
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
9044
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
6783
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
5437
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
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
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.