如何选择任何子节点的值为"异常"的"消息"节点。
<?xml version="1.0" encoding="UTF-8"?>
<Envelope>
<Message>
<MessageId>1</MessageId>
<Merchant>
<Type>Supplier</Type>
<Id>23</Id>
</Merchant>
<Operation>Create</Operation>
<SKU>AVRCD_002</SKU>
<Attribute>
<country>South Africa</country>
<artist>Anneli Van Rooyen</artist>
<composer>Anneli Sale</composer>
</Attribute>
</Message>
<Message>
<MessageId>2</MessageId>
<Merchant>
<Type>Supplier</Type>
<Id>EXCEPTION</Id>
</Merchant>
<Operation>Create</Operation>
<SKU>AVRCD_002</SKU>
<Attribute>
<country>EXCEPTION</country>
<artist>Anneli Van Rooyen|Lorenzo Tieghi</artist>
<composer>Sale Anneli</composer>
</Attribute>
</Message>
</Envelope>
下面您需要指定确切的子项。我不想那样做。我只想要/Message 如果其中有任何内容具有"异常"的值。
<xsl:copy-of select="/Envelope/Message[Attribute/country = 'EXCEPTION' or Merchant/Id = 'EXCEPTION']"/>
试试这个,它会检查任何后代文本节点是否等于"EXCEPTION">
<xsl:copy-of select="/Envelope/Message[.//text() = 'EXCEPTION']"/>