[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XPath context evaluation

Subject: XPath context evaluation
From: Victor Toni <xsl-list@xxxxxxxxx>
Date: Fri, 12 May 2006 14:03:58 +0200
context evaluation
I apologize for hijacking the XSL list for XPath questions, I wish there
would be some kind of XPath list ..

I have written some XSL-like application (maybe a bit more like FOP)
which uses the results of XPath expression as trigger for further
processing:
The attached file is a stripped down example of an XML file I would like
to process. At some point I am iterating over the <some> element and
it's children.
I would like to retrieve the associated <info> element from the
<infoList> for a given <id> element in the <idList>.
Since the application is agnostic about the data it reads I want to use
an XPath expression to find the correct element. Using a string as '123'
(e.g. "//info[id = '123']" ) shows no issues, however I am not able to
use the current context (one of the <id> elements in the <idList>) to
evaluate an XPath expression as "//info[id = .]" or "//info[string(id) =
(.)]".

Am I missing something obvious, is this a restriction of XPath?

Kindest regards,
Victor


------------------------------------------------------



<?xml version="1.0" encoding="UTF-8"?> <root> <infoList> <info> <name>abc</name> <id>123</id> </info> <info> <name>klm</name> <id>456</id> </info> <info> <name>xyz</name> <id>789</id> </info> </infoList> <data> <someList> <some> <readme>some words</readme> <idList> <id>123</id> </idList> </some> <some> <readme>some more words</readme> <idList> <id>123</id> <id>456</id> </idList> </some> <some> <readme>famous last words</readme> <idList> <id>456</id> <id>789</id> </idList> </some> </someList> </data> </root>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.