xml - How do I find and display CaseParty address? -


i loop in xml document below, , display (address) /integration/case/caseparty/address /integration/case/caseparty/connection[@word="dfd"].

if /integration/case/caseparty/address not found caseparty/connection[@word="dfd"], check address under partyid i.e /integration/party/address[@partycurrent="true"] , display 1 instead.

here xml document

<integration xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:tsg="http://tsgweb.com" xmlns:ixml="http://tsgweb.com" xmlns:cmcodequeryhelper="urn:cmcodequeryhelper" packageid="dl notice dvs" messageid="67084533" xmlns=""> <case op="e" internalid="1617088326" id="12120229" xmlns:user="http://tylertechnologies.com">     <caseparty id="16731290" internalcasepartyid="1634787102" internalpartyid="1614631672">         <connection word="dfd" baseconnection="df" id="36370323" internalcasepartyconnectionid="1636469444">             <description>defendant</description>         </connection>         <address casecorrespondence="true" id="17875824" type="standard">             <addressline2>3712 testing rd</addressline2>             <addressline4>st paul, ny, 21457</addressline4>             <block>3712</block>             <street>testing</street>             <addrsfxky word="rd">road</addrsfxky>             <city>st paul</city>             <state>ny</state>             <zip>21457</zip>             <foreign>false</foreign>             <timestampcreate>5/27/2015 10:34:08 am</timestampcreate>         </address>         <timestampcreate>1/29/2015 5:04:53 pm</timestampcreate>         <timestampchange/>     </caseparty> </case> <party id="16731290" internalpartyid="1614631672">     <address partycorrespondence="true" partycurrent="true" id="17867956" type="standard">         <addressline2>1906 3rd ave s #36</addressline2>         <addressline4>denver, co, 55408</addressline4>         <block>1906</block>         <street>3rd ave s #36</street>         <city>denver</city>         <state>co</state>         <zip>87459</zip>         <foreign>false</foreign>     </address> </party> 

desired output should ny address.

i not sure how check address both xpaths /integration/case/caseparty/address , /integration/party/address

xsl code.

<xsl:value-of select="/integration/case/caseparty/connection[@word="dfd"]/address"/>

an xpath returns node set (or possibly nothing), in case union them in such way select one. considering choice this:

rule1 | rule2[not(rule1)]

you rule1 if passes, or rule2 (if passes) or nothing if both not pass.

rule1 = /integration/case/caseparty/address[preceding-sibling::connection[@word='dfd']]

rule2 = /integration/party/address[@partycurrent='true']

(/integration/case/caseparty/address[preceding-sibling::connection[@word='dfd']] | /integration/party/address[@partycurrent='true'][not(/integration/case/caseparty/address[preceding-sibling::connection[@word='dfd']])])[1] 

note added [1] predicate @ end not know whether have multiple addresses in each case. need if possible in data not return multiple nodes.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -