Subject:Mapping Alternatives Author:R Baseley Date:25 Sep 2007 11:11 AM
I am a newbie at SS and XSLT.
I must process text that contains codes that determines on which document it will appear.
(A coded text appears on standard document A)
(H codded text appears on standard document H)
I have this XML now and can change it.
<NovusSalesOrderHeaderText>/H/ 1 X 20' CONTAINERS STC: </NovusSalesOrderHeaderText>
<NovusSalesOrderHeaderText>/A/ 1 X 20' CONTAINERS STC: </NovusSalesOrderHeaderText>
<NovusSalesOrderHeaderText>/H/ 16 PALLETS X 40 BAGS X 25KGS OR </NovusSalesOrderHeaderText>
<NovusSalesOrderHeaderText>/A/ 16 PALLETS X 40 BAGS X 25KGS OR </NovusSalesOrderHeaderText>
I wonder which way is easier to handle the text to do mapping all text that has the same code to a single text field? 1 or 2 below?
1. With code as attribute?
<NovusSalesOrderHeaderText code='H'>1 X 20' CONTAINERS STC: </NovusSalesOrderHeaderText>
<NovusSalesOrderHeaderText code='A'>1 X 20' CONTAINERS STC: </NovusSalesOrderHeaderText>
2. With code as node?
<NovusSalesOrderHeaderText>
<H>1 X 20' CONTAINERS STC: </H>
<A>1 X 20' CONTAINERS STC: </A>
</NovusSalesOrderHeaderText>
Both layouts are correct; in one case you can select them via an attribute value, in the other using the element name. The XSLT code used to manipulate them should have pretty much the same complexity.
In the end it's just a matter of personal taste which one you pick.