D
Doug
I need to compare two "address" structures within a document, and
perform some action if they are not equal.
The XML document is a purchase order, with an address at both the
header and line item level:
<Order>
<Header>
... other header level stuff ...
<Address>
<AddressLine>address 1</AddressLine>
<AddressLine>address 2</AddressLine>
<CityName>city</CityName>
<PostalCode>post code</PostalCode>
<PostalCountry>country</PostalCountry>
</Address>
</Header>
<Body>
<LineItem>
... other line item stuff ...
<Address>
<AddressLine>address 1</AddressLine>
<AddressLine>address 2</AddressLine>
<CityName>city</CityName>
<PostalCode>post code</PostalCode>
<PostalCountry>country</PostalCountry>
</Address>
</LineItem>
<LineItem>
... other line item stuff ...
<Address>
<AddressLine>somewhere different</AddressLine>
<CityName>other city</CityName>
<PostalCode>other post code</PostalCode>
<PostalCountry>country</PostalCountry>
</Address>
</LineItem>
</Body>
</Order>
For line items where the address is the same as the header level
address I need take no action. For addresses which differ I need to
populate an output attribute with a value. Therefore, ideally I'm
looking for an expression that I can use in the test clause of an "if"
element.
How can I compare the two address structures? I want "true" to mean
both structures are completely identical in element name, order and
value. In the above example the first line item's address is identical
to the header level, the second is different.
Is it possible to do this with XSLT? Can the XML be accessed in a
string format (like the .xml method of a node in DOM), so that I can
compare the resulting strings?
Thanks in advance for any help.
Doug
perform some action if they are not equal.
The XML document is a purchase order, with an address at both the
header and line item level:
<Order>
<Header>
... other header level stuff ...
<Address>
<AddressLine>address 1</AddressLine>
<AddressLine>address 2</AddressLine>
<CityName>city</CityName>
<PostalCode>post code</PostalCode>
<PostalCountry>country</PostalCountry>
</Address>
</Header>
<Body>
<LineItem>
... other line item stuff ...
<Address>
<AddressLine>address 1</AddressLine>
<AddressLine>address 2</AddressLine>
<CityName>city</CityName>
<PostalCode>post code</PostalCode>
<PostalCountry>country</PostalCountry>
</Address>
</LineItem>
<LineItem>
... other line item stuff ...
<Address>
<AddressLine>somewhere different</AddressLine>
<CityName>other city</CityName>
<PostalCode>other post code</PostalCode>
<PostalCountry>country</PostalCountry>
</Address>
</LineItem>
</Body>
</Order>
For line items where the address is the same as the header level
address I need take no action. For addresses which differ I need to
populate an output attribute with a value. Therefore, ideally I'm
looking for an expression that I can use in the test clause of an "if"
element.
How can I compare the two address structures? I want "true" to mean
both structures are completely identical in element name, order and
value. In the above example the first line item's address is identical
to the header level, the second is different.
Is it possible to do this with XSLT? Can the XML be accessed in a
string format (like the .xml method of a node in DOM), so that I can
compare the resulting strings?
Thanks in advance for any help.
Doug