I have a data file like this.....
<top>
<graph>
<part>
<param name="mass">1 </param>
</part>
<body name="nut">
<link href="#/top/graph['1']/part['1']"/>
</body>
</graph>
</top>
Notice the "link" is a path to another node in the file. I want to use
XSLT to process this file to print a table with the name of each body
and it's mass. But I cannot figure out how to do it. This is what I
tried......
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="top//body">
<p/> <xsl:value-of select="@name"/> has mass
<xsl:variable name="var" select="substri ng(link/@href,2)"/>
<xsl:value-of select="$var/param"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
But this doesn't work because it says $var/param is a syntax error. Any
ideas? Am I trying to do the impossible? I do not have any control of
the input data representation.
TIA, john 4 1593
John Henckel wrote: Notice the "link" is a path to another node in the file. I want to use XSLT to process this file to print a table with the name of each body and it's mass.
There is no dynamic XPath evaluation in XSLT unless your processor
provides an extension function e.g. like Saxon here
<http://saxon.sourcefor ge.net/saxon6.5.5/extensions.html #evaluate>
--
Martin Honnen http://JavaScript.FAQTs.com/
Martin Honnen wrote:
John Henckel wrote:
Notice the "link" is a path to another node in the file. I want to use XSLT to process this file to print a table with the name of each body and it's mass.
There is no dynamic XPath evaluation in XSLT unless your processor provides an extension function e.g. like Saxon here <http://saxon.sourcefor ge.net/saxon6.5.5/extensions.html #evaluate>
I suppose this one could be resolved by generating an XSL stylesheet
using XSL (or whatever...), stuffing in the XPath there, and then
executing that on the original document.
There is a prefix anti-aliasing feature, of which I can never remember
the name, to enable you to write stylesheet-spewing stylesheets
(distinguish output from instructions)
Soren
Soren Kuula wrote: I suppose this one could be resolved by generating an XSL stylesheet using XSL (or whatever...), stuffing in the XPath there, and then executing that on the original document.
Yes, that is also possible, most things done by an extension function
you can be solved without it by doing two or more transformation steps.
--
Martin Honnen http://JavaScript.FAQTs.com/
> There is no dynamic XPath evaluation in XSLT unless your processor provides an extension function
The "semi-standard" dynamic XPath extension is the one in the EXSLT
library. Some processors ship with part or all of EXSLT, some don't.
Check the docs.
Another solution is to use a stylesheet to generate a stylesheet with
your desired XPath, then apply that stylesheet as a separate pass.
--
Joe Kesselman / Beware of Blueshift!
(And don't confuse an institution's stated values with its policies.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ramon M. Felciano |
last post by:
Helo all --
I'm trying to gain a deeper understand for what type of
semi-declarative programming can be done through XML and XPath/XSLT.
I'm looking at graph processing problems as a testbed for this, and
came across a problem that I haven't been able to solve elegantly. The
problem is to find "linker" vertexes that a pair of verteces from a
pre-defined set. For example, if the graph verteces represent cities
and edges represent flights...
|
by: Sebastian Petzelberger |
last post by:
Hi group,
please give me an example of a xpath with regex or
better a link with examples.
Thanks in advance,
Sebastian
|
by: DV |
last post by:
Hello,
can anyone tell me or point me to somewhere what the exact differences
(in terms of when would I use what) between XPath, XLink, XPointer and
DOM are?
Does it require special software to use any of these, or can any
XML-aware software (parser/validator or xsl- enginge) use any of
these?
|
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
|
by: Murtaza Tinwala |
last post by:
Hi mates,
I have the following problem in XSLT. I have following variables:
ref-file = <path of XML document> eg "xmlDoc.xml"
repeatpath = <a repeat path expressed in Xpath like /root/person > eg
"/root/person"
node = <name of a child node in repeat path> eg" "name"
Now, I want to get to the 'node' in XSLT using Xpath.
| |
by: Son KwonNam |
last post by:
In XSLT, is this possible to get value from xml using XPath
which is in XSLT variable?
I mean XPath strings can be dynamic while XSL Transforming.
If possible, How??
Because I'm not a native English speaker, it's quite hard
to make the problem clear. Please see the following example.
|
by: Kathy Burke |
last post by:
Hi again,
I'm using the following xpath (works in visualizer) with a
SelectSingleNode("xpath") statement.
//Station/(WI])]/@order
Problem is I get an error "expression passed to this method should
result in a NodeSet". Of course, that (sort of) makes sense to me now (I
suppose just an attribute couldn't be a nodeset, but how would I go
|
by: Sergey Dubinets |
last post by:
In effort to prioritize our goals we composed the list of random features
each of them may add value to set of XSLT tools offered from Microsoft.
1. XSLTc (Compiler for XSLT stylesheets, that generates .NET
assemblies)
2. Performance improvements in the XslCompiledTransform
|
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...
|
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,...
|
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...
| |
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...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |