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

Re: current context preceding-sibling then following-

Subject: Re: current context preceding-sibling then following-sibling
From: Karl Stubsjoen <kstubs@xxxxxxxxx>
Date: Mon, 7 Mar 2005 12:33:26 -0700
following sibling current
Did the following message ever make the list?  I posted this a few days back.

current context preceding-sibling then following-sibling


On Fri, 4 Mar 2005 08:14:19 -0700, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
> Hello,
> 
> I have complex xpath query which I need help with.  Let me first jump
> to the question which appears to be the hangup:
> 
> the context of the following-sibling following a preceding-sibling
> should result you in the context of the current sibling?
> 
> Often times with a problem like this there is another or better
> approach.  I may have reached the point where I need to try another
> approach.  However, I am so close to the correct solution that I wish
> to persue this just a bit further.  Let me see if I can explain what
> it is I am trying to accomplish:
> 
> The short of it is, I am comparing the preceding-sibling with the
> current.  The preceding-sibling must contain the code "XYZ" when the
> current contains the code "WXY".
> 
> You derive the code to match by a code lookup which is part of the XML
> source.  So, for current you can determine what the
> preceding-sibling's code should be by first looking in the code
> section at the top of the source.
> 
> So, code "WXY" is only valid when the preceding-sibling is code "XYZ"
> (as an example).
> 
> A mock up XML:
> 
> <ROOT>
>  <CODES>
>    <CODE name="WXY">
>        <MATCH>XYZ</MATCH>
>    </CODE>
>  </CODES>
>  <RESULTS>
>      <RESULT code="XYZ" />
>      <RESULT code="WXY"/>
>  </RESULTS>
> </ROOT>
> 
> You might be asking why preceding-sibling followed by following-sibling:
> Because the RESULT code for current is actually an ID which is
> resolved in CODE lookup above (not shown here) ... well, let me just
> add the actual xpath expressions here and maybe it will be easier to
> understand...
> 
> My "hard coded method" works perfectly...
> 
> HARD CODED METHOD:
> =====================================================
> /root/recordset[@rsName='Memberships']/record[field[@fieldname='RefEntryActivityID']=
> ( 33 )]/preceding-sibling::record[field[@fieldname='ExitActivityValue']
> = ( 'W4' ) ]
> 
> Each value within the ( ) needs to be replaced with an appropriate
> xpath statement.
> 
> So, the first ( 33 ) above is replaced with the following:
> 
> /root/recordset[@rsName='Codes']/record[field[@fieldname='Section']= (
> 209 )]/field[@fieldname='ID']
> 
> This XPATH still works great but now I need to replace the ( 209 ),
> but this is not really an issue so we'll skip to the ( 'W4' ).
> 
> The ( 'W4' ) is replaced with:
> 
> /root/recordset[@rsName='Codes']/record[field[@fieldname='ID']= ( 33
> )]/field[@fieldname='Match']
> 
> Now, it is this next ( 33 ) which is the problem!  This value is
> really the current siblings RefEntryActivityID, which the current
> sibling is now out of context? (that is a question).  Notice that ( 33
> ) is part of the right hand side of a preceding-sibling.  So, couldn't
> I just go following-sibling at this point?  Which doesn't appear to be
> working... Here are my 3 attempts at getting this ( 33 ) value from
> the original current context (none work):
> 
> 33 = field[@fieldname='RefEntryActivityID']
> 33 = ./field[@fieldname='RefEntryActivityID']
> 33 = following-sibling::record/field[@fieldname='RefEntryActivityID']
> 
> Thanks for the help!
> 
> Karl

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.