Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 9th, 2006, 03:01 PM
Registered User
 
Join Date: May 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with XPATH Expression

I have an XML file as follows...
<CCR>
 <Body>
   <Encounters>
    <Encounter>
      <Source>
       <Actor>
           <ActorID>AA0009</ActorID>
           </Actor>
      </Source>
    </Encounter>
  </Encounters>
 </Body>
 <Actors>
  <Actor>
     <ActorID>AA0009</ActorID>
     <Person>
     <Name>
         <DisplayName>AR</DisplayName>
         </Name>
     </Person>
  </Actor>
  <Actor>
     <ActorID>AA00010</ActorID>
     <Person>
     <Name>
         <DisplayName>ART</DisplayName>
         </Name>
     </Person>
  </Actor>
  <Actor>
     <ActorID>AA00011</ActorID>
     <Person>
     <Name>
         <DisplayName>ER</DisplayName>
         </Name>
     </Person>
  </Actor>
 </Actors>
</CCR>

Using XPATH, how do I retrieve the 'displayname'(AR) by referencing it using the 'ActorID' (AA0009).

When I use the expression /CCR/Actors/Actor[ActorObjectID = /CCR/Body/Encounters/Encounter/Source/Actor/ActorID ]/Person/Name/DisplayName , I get all of the 3 'displayname' . I just want the display name that has AA0009 as the 'actorid'. How do i do it? I am using Altova StyleVision.

 
Old May 9th, 2006, 03:38 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I can't see why you would get anything with the path expression given because Actor doesn't have a child called ActorObjectID.

Try

/CCR/Actors/Actor[ActorID = /CCR/Body/Encounters/Encounter/Source/Actor/ActorID]/Person/Name/DisplayName

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath 2.0 every expression stolte XSLT 5 November 24th, 2008 03:32 PM
xpath-nested expression vinod.kumbar RSS and Atom 0 July 8th, 2008 11:36 AM
XPath Expression NEO1976 XSLT 11 August 2nd, 2006 02:28 AM
Need help with XPATH Expression benomathew XSLT 1 May 12th, 2006 04:41 AM
Logical XPath Expression rohit72 XML 0 June 23rd, 2004 11:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.