Advertisement

07.14.2008 at 02:08PM PDT, ID: 23564244
[x]
Attachment Details

Does XPath have a syntax for the starting node?

Asked by pebbleman in Extensible Markup Language (XML), Extensible HTML (XHTML), Extensible Stylesheet Language Transformation (XSLT)

Tags: Altova, Stylevision, Professional 2008, XPath, 1.0/2.0

Greetings!

I have an XML document which I've simplified to the snippet below.  It lists different versions of different classes, and then what the currently selected version of each class is.  There is an associated schema (also left out for simplicity) that enforces a composite relationship between the classes and current classes (such that the current class is always a valid combination of clsid and version as defined in the classes branch).

In the ui for this (I'm using Altova Stylevision if that makes any difference) I have 2 combo boxes to let the user define the current version of each class.  When a particular clsid is selected in the first combo box, I want to filter the versions available in the second combo box so that only versions for the selected class are visible (e.g. if you select CLSID_ClassB you get versions 3 and 4).  I can seed the combo boxes by either hard coding a list (which is out of the question), or by specifying an XPath expression.

My question is essentially what is the XPath expression I need?  With the context node starting at /myRoot/currentClasses/class[1] for example, the expression should look something like:

../../classes/class[@clsid = 'CLSID_ClassA']/@version

The problem with this is that CLSID_ClassA is hardcoded, but I don't want it to be.  I basically want to preserve the context node where the expression processing starts, and reference it later in the predicate like this:

../../classes/class[@clsid = <the original node>/@clsid]/@version

Is it possible to do this using XPath syntax?

Thanks!Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
<myRoot>
	<classes>
		<class clsid="CLSID_ClassA" version="1"/>
		<class clsid="CLSID_ClassA" version="2"/>
		<class clsid="CLSID_ClassB" version="3"/>
		<class clsid="CLSID_ClassB" version="4"/>
	</classes>
	<currentClasses>
		<class clsid="CLSID_ClassA" version="1"/>
		<class clsid="CLSID_ClassB" version="3"/>
	</currentClasses>	
</myRoot>
 
Loading Advertisement...
 
[+][-]07.14.2008 at 10:23PM PDT, ID: 22004322

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 01:47AM PDT, ID: 22005083

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Extensible Markup Language (XML), Extensible HTML (XHTML), Extensible Stylesheet Language Transformation (XSLT)
Tags: Altova, Stylevision, Professional 2008, XPath, 1.0/2.0
Sign Up Now!
Solution Provided By: Gertone
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.15.2008 at 02:15AM PDT, ID: 22005191

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 02:38AM PDT, ID: 22005311

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 02:54AM PDT, ID: 22005362

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 02:59AM PDT, ID: 22005384

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 03:05AM PDT, ID: 22005404

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.15.2008 at 08:29AM PDT, ID: 22007954

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 09:08AM PDT, ID: 22089867

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 09:10AM PDT, ID: 22089893

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628