我无法弄清楚如何过滤这段 xml。我svcProvNbr
想得到userServiceCde = OASV
<dataExtract xmlns="http://dtd-sirvahub.sirva.com/xml/SCHEMA/ATS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://dtd-sirvahub.sirva.com/xml/SCHEMA/ATS http://dtd-sirvahub.sirva.com/xml/SCHEMA/ATS/dataExtract.xsd">
<shipment>
<location lctnSeqNbr="001">
<lctnServiceProvider>
<userServiceCde>EASV</userServiceCde>
<svcProvNbr>1470-000</svcProvNbr>
<svcProvTypeCde>A</svcProvTypeCde>
</lctnServiceProvider>
<lctnServiceProvider>
<userServiceCde>OASV</userServiceCde>
<svcProvNbr>1470-000</svcProvNbr>
<svcProvTypeCde>A</svcProvTypeCde>
</lctnServiceProvider>
</location>
</shipment>
</dataExtract>
我尝试了几种不同的方法,但没有运气
xmlalliedxml.query
('declare namespace r = "http://dtd-sirvahub.sirva.com/xml/SCHEMA/ATS";
data(/r:dataExtract/r:shipment/r:location[@lctnSeqNbr=sql:variable("@vcSegmentNo")]/r:lctnServiceProvider.userServiceCde[.="OASV"]/r:svcProvNbr)')
和
xmlalliedxml.query
('declare namespace r = "http://dtd-sirvahub.sirva.com/xml/SCHEMA/ATS";
for $sp in /r:dataExtract/r:shipment/r:location[@lctnSeqNbr=sql:variable("@vcSegmentNo")]/r:lctnServiceProvider/r:svcProvNbr
where $sp/r:dataExtract/r:shipment/r:location[@lctnSeqNbr=sql:variable("@vcSegmentNo")]/r:lctnServiceProvider/r:userServiceCde[.="OASV"]
return
$sp')