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

Complex XPath question

Subject: Complex XPath question
From: dvint@xxxxxxxxx
Date: Fri, 1 Mar 2013 14:38:38 -0800
 Complex XPath question
I have the following XML:

<wrapper>
<object class="Page" package="com.atlassian.confluence.pages">
	<id name="id">37716253</id>
	<property name="title">
		<![CDATA[COMPARE]]>
	</property>
	...
	<property name="version">3</property>
	<property name="creatorName">
		<![CDATA[wbenica]]>
	</property>
	<property name="creationDate">2012-11-16 14:00:35.000</property>
</object>
<object class="Page" package="com.atlassian.confluence.pages">
	<id name="id">37716529</id>
	<property name="title">
		<![CDATA[COMPARE]]>
	</property>
	...
	<property name="version">1</property>
	<property name="creatorName">
		<![CDATA[wbenica]]>
	</property>
	<property name="creationDate">2012-11-16 14:00:35.000</property>
</object>
<object class="Page" package="com.atlassian.confluence.pages">
	<id name="id">37716528</id>
	<property name="title">
		<![CDATA[COMPARE]]>
	</property>
	...
	<property name="version">2</property>
	<property name="creatorName">
		<![CDATA[wbenica]]>
	</property>
</object>
<object class="Page" package="com.atlassian.confluence.pages">
	<id name="id">37716253</id>
	<property name="title">
		<![CDATA[SOME OTHER TITLE]]>
	</property>
	...
	<property name="version">3</property>
	<property name="creatorName">
		<![CDATA[wbenica]]>
	</property>
	<property name="creationDate">2012-11-16 14:00:35.000</property>
</object>
</wrapper>

I want to find the <id> element value for the <object> element that has
the highest version <property> (of those matching the title) and matches the
title <property> element for 'COMPARE'.

The following matchs all <object>
elements that have a title and version:

//object[property[@name='title'] and property[@name='version']]

How do I look for a specific title and find the highest version? Is it
possible in one XPath statement?

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.