Forum Discussion

roryLIT's avatar
roryLIT
Contributor
11 years ago

XQuery function to get only part of a node value

I currently have the following XPath to return the value 050254774-0001 from my response XML:

declare namespace _xml='http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/';
declare namespace re='http://pm.lmig.com/cl/FNOLServicesMediationModule/iAcordClaimRegistration';
//re:claimRegistrationResponse[1]/ACORD[1]/_xml:ClaimsSvcRs[1]/_xml:ClaimsNotificationAddRs[1]/_xml:ClaimsOccurrence[1]/_xml:ItemIdInfo[1]/_xml:InsurerId[1]


This is used in the Property Transfer step

I would like to be able to return just the first part of the value before the "-" so I would like to return 050254774 and leave out the -0001

Any ideas? Would I use XQuery?

Thanks

1 Reply

  • SiKing's avatar
    SiKing
    Community Expert
    substring-before(//*:ACORD[1]/*:ClaimsSvcRs[1]/*:ClaimsNotificationAddRs[1]/*:ClaimsOccurrence[1]/*:ItemIdInfo[1]/*:InsurerId[1], "-")

    I suspect the XPath can be optimized further to be legible.