The repetition path /directory/customer/city/text() is in effect, and the order of XPath expressions is as follows. Notice that the first occurrence of the node division precedes the first occurrence of the node city.
Column | XPath expression |
---|---|
CUSTOMER | /directory/customer/@name |
DIVISION | /directory/customer/division/text() |
CITY | /directory/customer/city/text() |
The input data consists of four rows:
CUSTOMER | DIVISION | CITY |
---|---|---|
Acme |
Toys |
Boston |
Acme |
Toys |
New York |
Acme |
Chemical |
Boston |
Acme |
Chemical |
New York |
Because the node division precedes city, the output is as follows:
<directory> <customer name="Acme"> <division>Toys</division> <city>Boston</city> <city>New York</city> </customer> <customer name="Acme"> <division>Chemical</division> <city>Boston</city> <city>New York</city> </customer> </directory>
If you reorder the XPath expressions, the result changes. For example, the XPath expression for CITY is now in the middle position:
Column | XPath expression |
---|---|
CUSTOMER | /directory/customer/city/text() |
CITY | /directory/customer/city/text() |
DIVISION | /directory/customer/division/text() |
This reordering generates the following output:
<directory> <customer name="Acme"> <city>Boston</city> <city>New York</city> <division>Toys</division> </customer> <customer name="Acme"> <city>Boston</city> <city>New York</city> <division>Toys</division> </customer> </directory>