XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Brightman MkhwanaziSubject: xpath to compare two values from one xml
Author: Brightman Mkhwanazi
Date: 09 Nov 2010 10:10 AM

I have an xml that i need to process only when the header record is different from the values in the detail record.
The header record repeats and the detail record repeats. I want to only process the record once it happens that the values from the detail record are different from the header record.

I want to compare the two lang values using xpath.

/root/input_data/hdr/lang != /root/input_data/dtl/data/lang

I have attached the xml document.


UnknownTestData.xml
TestData.xml

Posttop
Ivan PedruzziSubject: xpath to compare two values from one xml
Author: Ivan Pedruzzi
Date: 11 Nov 2010 09:28 PM

Brightman

You should use positional predicates to compare precisely nodes and not
node sets

<xs:if test="/root[1]/input_data[1]/hdr[1]/lang[1] != /root[1]/input_data[1]/dtl[1]/data[1]/lang[1]">

<xsl:apply-templates/>

</xs:if>

Hope thia helps
Ivan Pedruzzi

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.