我有以下XML:
<LowestOfferListings>
<LowestOfferListing>
<Qualifiers>
<ItemCondition>New</ItemCondition>
<ItemSubcondition>New</ItemSubcondition>
<FulfillmentChannel>Merchant</FulfillmentChannel>
<ShipsDomestically>True</ShipsDomestically>
<ShippingTime>
<Max>0-2 days</Max>
</ShippingTime>
<SellerPositiveFeedbackRating>95-97%</SellerPositiveFeedbackRating>
</Qualifiers>
<NumberOfOfferListingsConsidered>5</NumberOfOfferListingsConsidered>
<SellerFeedbackCount>9197</SellerFeedbackCount>
<Price>
<LandedPrice>
<CurrencyCode>JPY</CurrencyCode>
<Amount>1675.00</Amount>
</LandedPrice>
<ListingPrice>
<CurrencyCode>JPY</CurrencyCode>
<Amount>1275.00</Amount>
</ListingPrice>
<Shipping>
<CurrencyCode>JPY</CurrencyCode>
<Amount>400.00</Amount>
</Shipping>
</Price>
<MultipleOffersAtLowestPrice>False</MultipleOffersAtLowestPrice>
</LowestOfferListing>
<LowestOfferListing>
<Qualifiers>
<ItemCondition>New</ItemCondition>
<ItemSubcondition>New</ItemSubcondition>
<FulfillmentChannel>Merchant</FulfillmentChannel>
<ShipsDomestically>False</ShipsDomestically>
<ShippingTime>
<Max>0-2 days</Max>
</ShippingTime>
<SellerPositiveFeedbackRating>90-94%</SellerPositiveFeedbackRating>
</Qualifiers>
<NumberOfOfferListingsConsidered>3</NumberOfOfferListingsConsidered>
<SellerFeedbackCount>1430</SellerFeedbackCount>
<Price>
<LandedPrice>
<CurrencyCode>JPY</CurrencyCode>
<Amount>1820.00</Amount>
</LandedPrice>
<ListingPrice>
<CurrencyCode>JPY</CurrencyCode>
<Amount>1240.00</Amount>
</ListingPrice>
<Shipping>
<CurrencyCode>JPY</CurrencyCode>
<Amount>580.00</Amount>
</Shipping>
</Price>
<MultipleOffersAtLowestPrice>False</MultipleOffersAtLowestPrice>
</LowestOfferListing>
</LowestOfferListings>
我试图计算LowestOfferListing
所有ShipsDomestically='False'
元素的数量,同时忽略任何命名空间约束。
这将让我了解所有列表:
count(//*[local-name()='LowestOfferListing'])
如何使用子元素过滤掉那些?
我尝试了这些,但它们不起作用:
count(//*[local-name()='LowestOfferListing']/descendant::*[not(ShipsDomestically='False')])
count(//*[local-name()='LowestOfferListing'][not(ShipsDomestically='False')])
count(//*[local-name()='LowestOfferListing'][not(local-name()='ShipsDomestically'='False')])
答案 0 :(得分:0)
这应该有效
count(//*[local-name()='LowestOfferListing' and descendant::ShipsDomestically = 'False'])