Suppose I have xml:
<Products>
<Product name="Liquid Oxygen">
<Manufacturer name="Universal Exports" country="UK" />
</Product>
<Product name="Hydrazine">
<Manufacturer name="ACME Inc." country="USA" />
</Product>
<Product name="Gaseous Oxygen" obsolete="true">
<Manufacturer name="Universal Exports" country="UK" />
</Product>
<Product name="Liquid Nitrogen">
<Manufacturer name="Penguins R Us" country="Antarctica" />
</Product>
</Products>
And I want to allocate Product nodes with a node Manufacturerfrom @countryfrom UK, but it doesnβt @obsolete true. I can say that
/Products/Product[Manufacturer/@country = 'UK' and not(@obsolete = 'true)]
or
/Products/Product[Manufacturer/@country = 'UK'][not(@obsolete = 'true')]
and both will get the nodes I need.
My question is, is there any functional difference between the two approaches to the i-conditions? Is there a situation where different approaches can give different results? (I understand that andserves purpose in more difficult conditions). Stylistically preferable to another?
(I use C # and .NET 2.0, but I do not believe that this will affect the answer)
source
share