I need to use xsl/xpath (version 1.0) to do something special (for simplifying, say insert some dummy text) when the value of SupplierId changes. I need to handle 3 variations;
- Do something when on the first Order (the first occurence of SupplierId)
- Do somwthing when on OrderId O3 (SupplierId changed from S1 to S2)
- Do something when on the last Order (the last occurence of SupplierId)
.
<?xml version="1.0" encoding="utf-8"?>
<Orders>
<Order>
<OrderId>O1</OrderId>
<SupplierId>S1</SupplierId>
</Order>
<Order>
<OrderId>O2</OrderId>
<SupplierId>S1</SupplierId>
</Order>
<Order>
<OrderId>O3</OrderId>
<SupplierId>S2</SupplierId>
</Order>
<Order>
<OrderId>O4</OrderId>
<SupplierId>S2</SupplierId>
</Order>
<Order>
<OrderId>O5</OrderId>
<SupplierId>S2</SupplierId>
</Order>
</Orders>
I've tried using preceding-sibling, following-sibling, etc, but haven't found out of it yet. I'd appreciate any help on this newbie question.
Wally