473,394 Members | 1,946 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XPath statement from document

Hi All,

I've got a document containing a internal lookups (I want to show a
relationship hierarchy, starting at an arbitrary point, or series of
points).

It's easy if I know what item IDs I want to refer to during processing,
I can put in a @refid, @refids, or child elements listing the IDs to
process. No big deal. I'd *rather*, however, be able to specify an
XPath and have that resolved during transformation.
<show-tree refid='some-id' />

easy

<show-tree refids='some-id another-id' />
<show-tree>
<ref refid='some-id' />
<ref refid='another-id' />
</show-tree>

also easy.

<show-tree xpath='//element[type="some-type"]' />

I can't figure out. Ideally, something like

<xsl:template match='show-tree'>
<xsl:variable name='nodes' select='{@xpath}' />
<!-- do stuff with nodes -->
</xsl:template>

would be lovely, but select doesn't seem to like this.

I'm using Saxon for my transformations. I'm willing to use extensions,
though I'd rather not... but I'll accept expediency over purity.

Can anyone please provide some illumination or answers? I probably
*can* build a selection mechanism into my schema, but XPath is made for
this sort of thing; I'd like to be able to it rather than some ad hoc
construction if I can.
Thank you,
Keith
--
Keith Davies "That's such a perfect idea I've just now
ke**********@kjdavies.org begun building an ass-kicking machine so I
don't get an injury from kicking myself."
-- Ed Chauvin IV, rec.games.frp.dnd
Jul 20 '05 #1
1 1330
On 2004-07-19, Keith Davies <kj******@kjdavies.kjdavies.org> wrote:

I've got a document containing a internal lookups (I want to show a
relationship hierarchy, starting at an arbitrary point, or series of
points).

It's easy if I know what item IDs I want to refer to during processing,
I can put in a @refid, @refids, or child elements listing the IDs to
process. No big deal. I'd *rather*, however, be able to specify an
XPath and have that resolved during transformation.

<xsl:template match='show-tree'>
<xsl:variable name='nodes' select='{@xpath}' />
<!-- do stuff with nodes -->
</xsl:template>

would be lovely, but select doesn't seem to like this.


<xsl:template match='show-tree'>
<xsl:variable name='nodes' select='saxon:evaluation(@xpath)' />
<!-- do stuff with nodes -->
</xsl:template>

Slightly suboptimal, in that I have to use an extension. Seeing as XSLT
doesn't allow this sort of behavior, I guess I'll have to live with it.
Good enough.
Keith
--
Keith Davies "That's such a perfect idea I've just now
ke**********@kjdavies.org begun building an ass-kicking machine so I
don't get an injury from kicking myself."
-- Ed Chauvin IV, rec.games.frp.dnd
Jul 20 '05 #2

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

Similar topics

8
by: Terry P | last post by:
Are there any tools (java classes, tag libraries) which can translate xpath statements into a SQL query? Given an xpath query which has a predicate that filters node values or attributes, I want...
2
by: Chucker | last post by:
Hi folks, I would like to select some nodes from a very large XML document and then apply a stylesheet to the dom fragment / nodelist that is the result of my XPath-Query. I used to use MSXML...
8
by: Joe Pannone | last post by:
Does anyone have an example on using an XPath statement (in VB.NET) where the source XML document is NOT a file, but a 'text' value from SQL Server?
0
by: jacqueharper | last post by:
I am having a problem with an Excel ListObject in my C# .NET application. I am trying to map an XML schema to a ListObject, and continue to get the error "The XPath is not valid because either the...
3
by: ziggyware | last post by:
Hi All, I have updated my XPath Generator software: XPath Studio .NET. ( http://www.ziggyware.com/downloads.php?cat_id=2 ) Easily select nodes from an xml file to generate XPath statements ...
1
by: Yossi | last post by:
Nice tool! I am looking for something that will do the reverse. I have a whole bunch of XPath statements and I need to use them to generate and populate an XML document. I have mapping file...
14
by: Mat| | last post by:
Hello :-) I am learning XPath, and I am trying to get child nodes of a node whose names do *not* match a given string, e.g : <dummy> <example> <title>Example 1</title> <body>this is an...
6
by: Derek Hart | last post by:
I bring in an xml file into vb.net by using xmlDoc.LoadXml(XMLString) - I run xpath statements against the xml file to grab data from it, so I use, as an example, //Vehicles/Vehicles/@make to get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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
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...

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.