我试图在我的edifact文件的最后一个Line元素中找到IMD,在biztalk - orchestration中使用xpath。 这是我的xpath:
LastLineName = xpath(Message_2,"/*[local-name()='EFACT_D96A_INVOIC' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='LINLoop1' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='IMD_2' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='C273_2' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='C27304' and namespace-uri()='']last()");
这是我的edifat文件:
UNB+UNOB:1+BTS-SENDER:ZZZ+RECEIVE-PARTNER:ZZZ+130418:1513+19++++0++0'
UNH+19+INVOIC:D:01B:UN:EAN010'
BGM+380+353795+9'
DTM+171:2013-04-18'
LIN+1++8886419315339:VN'
IMD+++:::Razer Sphex - Full retai'
QTY+47:10'
PRI+AAA:89'
LIN+3++8886419330028:VN'
IMD+++:::Razer Deathadder RESPAWN'
QTY+47:10'
PRI+AAA:347'
LIN+4++8886419330127:VN'
IMD+++:::Razer Abyssus Gaming Mou'
QTY+47:1'
PRI+AAA:242,6'
LIN+5++8886419330660:VN'
IMD+++:::Razer Imperator 2012 Exp'
QTY+47:2'
PRI+AAA:447,5'
LIN+6++8886419311454:VN'
IMD+++:::Razer Lycosa gaming keyb'
QTY+47:2'
PRI+AAA:511,5'
LIN+7++8886419311614:VN'
IMD+++:::Razer Arctosa Silver Key'
QTY+47:2'
PRI+AAA:312'
LIN+10++8886419340317:VN'
IMD+++:::Anansi (MMO Keyboard)'
QTY+47:1'
PRI+AAA:639'
LIN+11++8886419330509:VN'
IMD+++:::Razer Naga - Molten Edit'
QTY+47:2'
PRI+AAA:479,5'
LIN+12++8886419330981:VN'
IMD+++:::Razer Naga Hex MOBA/ Act'
QTY+47:1'
PRI+AAA:479,5'
LIN+13++8886419312277:VN'
IMD+++:::Razer Carcharias Gaming'
QTY+47:2'
PRI+AAA:479,5'
LIN+14++8886419312628:VN'
IMD+++:::Razer Electra headset'
QTY+47:4'
PRI+AAA:383,5'
UNS+S'
MOA+139:790'
UNT+50+19'
UNZ+1+19'
它返回:
有无效令牌
答案 0 :(得分:2)
最后,你有
last()
位置索引器必须用方括号括起来。
所以简单地说:
[last()]
答案 1 :(得分:1)
我解决了。对不起阿兰,你对[last()]完全正确。我只需将它放在另一个地方而不是建议的地方。
这是解决方案:
/*[local-name()='EFACT_D96A_INVOIC' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='LINLoop1' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006'][last()]/*[local-name()='IMD_2' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='C273_2' and namespace-uri()='http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006']/*[local-name()='C27304' and namespace-uri()='']/text()