Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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 January 31st, 2006, 07:26 AM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with x-path expression


Hi all,
My problem is that I have to write a xslt that will be applied to the xml document
Here is a simple xml input file:--

 In this file < transaction > node may be in multiple numbers (1 to many)..

<response>
<transaction type="RLIN">
       <owner>P</owner>
       <name1></name1>
       <name2></name2>
   </transaction>
   <transaction type="RLIN">
             <owner>S</owner>
       <name1></name1>
       <name2></name2>
   </transaction>
……
…..
…….
<response>


Here <owner> can have value any one of them..
P S or O..
only condition is that there can be only one <owner> that have value as P



 Here is my Output xml file (Output.xml)

             <response>

<name1>XX </name1>
<name2>XX</name2>
        </ response >



Now the logic for the value XX is
the value of XX comes from the <name1> <name2> in that particular transaction node where owner is P

so what will be my x-path expression
thanks in advance ..

regards
Ashu



 
Old January 31st, 2006, 03:58 PM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to jkmyoung
Default

/response/transaction/owner[.='P'] should get you to the owner you're looking for.

 
Old February 1st, 2006, 02:16 AM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
thanks for replying ..
 but my quesion is that how can I select the value of <name1> and <name2> from the same tranaction node where owner value is P...




 
Old February 1st, 2006, 05:07 AM
Authorized User
 
Join Date: Oct 2005
Location: , , Philippines.
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

save the value of the owner to a variable and use that in the xpath given by jkmyoung =D





Similar Threads
Thread Thread Starter Forum Replies Last Post
Path problem sureshp2p Apache Tomcat 1 September 4th, 2007 06:13 AM
Implementing the all-path shortest path problem bitwords XSLT 1 December 6th, 2006 11:37 AM
Problem with this expression: ^\d{3}$ ebukhman BOOK: Beginning Regular Expressions 1 October 24th, 2006 06:44 AM
DB Path problem creative_eye Classic ASP Databases 1 March 7th, 2005 11:14 AM





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