Xpath - Check filename attribute after FSA multiple collect
Request:
Write the rule that will check if the filename has an extension .inv or .sls, and depending on that will be extracted in a separate folders.
The Process Data:
<ProcessData>
<BPID>5060827</BPID>
<currentTimeMillis>1288382751118</currentTimeMillis>
<time>20101029160511851</time>
<loop_counter>1</loop_counter>
<X12_ArchiveDirectory>/app/archive/</X12_ArchiveDirectory>
<FSA_Document1 SCIObjectID="serverName:38a97b0b:12bf942739e:1144" filename="ConcatSLS2.sls"/>
<FSA_Document2 SCIObjectID="" filename="ConcatINV2.inv"/>
<FSA_DocumentCount>2</FSA_DocumentCount>
<Prev_NotSuccess_Adv_Status/>
<INVOKE_ID_LIST>5060828</INVOKE_ID_LIST>
</ProcessData>
The wrong XPath used in the rule is:
contains(string('FSA_Document',//loop_counter/text(),' ',SCIObjectID/text()), string('.sls')
… and it does not work!!!
To check if the filename attribute in FSA_Document[n] element contains ‘inv’ or ‘sls’, XPath should be like this:
contains(//*[name()=concat('FSA_Document',//loop_counter/text())]/@filename,'.sls')
That would be interpreted as:
… check if the attribute ’filename’ (@filename)
… inside of the element which name is FSA_Document[n] (composed dynamically by concat function)
… contains ‘.sls’ string
Result will be boolean, true or false, and depending on that FSA extraction folder can be set .