Seeking advice from the experts on how to attack an XSLT problem

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I need to process a document with the following format, example:
<?xml version="1.0" encoding="UTF-8"?><br/>
<rows><br/>
<SalesTerrChk/><br/>
<row><br/>
<SiteType>M</SiteType><br/>
<Type>P</Type><br/>
<DWHSalesTerritoryID>4</DWHSalesTerritoryID><br/>
<SalesTerrRowID>ADOA-4VHJYJ</SalesTerrRowID><br/>
<SiteID>ADOA-3ZVNEI</SiteID><br/>
<Channel>VS</Channel><br/>
<StartDate>2008-01-01T00:00:00.000</StartDate><br/>
<Brand>-</Brand><br/>
<Rank>1</Rank><br/>
<Delete/><br/>
<Update/><br/>
</row> - <row><br/>
<SiteType>D</SiteType><br/>
<Type>P</Type><br/>
<DWHSalesTerritoryID>10</DWHSalesTerritoryID><br/>
<SalesTerrRowID>ADOA-4VHJYG</SalesTerrRowID><br/>
<SiteID>ADOA-3ZVNEO</SiteID><br/>
<Channel/><br/>
<StartDate>2009-01-01T00:00:00.000</StartDate><br/>
<Brand>-</Brand><br/>
<Rank>2</Rank><br/>
<Delete/><br/>
<Update/><br/>
</row> - <row><br/>
<SiteType>M</SiteType><br/>
<Type>C</Type><br/>
<DWHSalesTerritoryID>3</DWHSalesTerritoryID><br/>
<SalesTerrRowID>ADOA-4VHJYF</SalesTerrRowID><br/>
<SiteID>ADOA-3ZVNEI</SiteID><br/>
<Channel>BT</Channel><br/>
<StartDate>2010-01-01T00:00:00.000</StartDate><br/>
<Brand>-</Brand><br/>
<Rank>3</Rank><br/>
<Delete/><br/>
<Update/><br/>
</row> - <row><br/>
<SiteType>D</SiteType><br/>
<Type>P</Type><br/>
<DWHSalesTerritoryID>13</DWHSalesTerritoryID><br/>
<SalesTerrRowID>ADOA-4VHJYO</SalesTerrRowID><br/>
<SiteID>ADOA-3ZVNEO</SiteID><br/>
<Channel>BT</Channel><br/>
<StartDate>2010-01-01T00:00:00.000</StartDate><br/>
<Brand>-</Brand><br/>
<Rank>3</Rank><br/>
<Delete/><br/>
<Update/><br/>
</row> - <row><br/>
<SiteType>D</SiteType><br/>
<Type>C</Type><br/>
<DWHSalesTerritoryID>16</DWHSalesTerritoryID><br/>
<SalesTerrRowID>ADOA-4VHJYL</SalesTerrRowID><br/>
<SiteID>ADOA-3ZVNEO</SiteID><br/>
<Channel/><br/>
<StartDate>2011-01-01T00:00:00.000</StartDate><br/>
<Brand>-</Brand><br/>
<Rank>5</Rank><br/>
<Delete/><br/>
<Update/><br/>
</row> - <row><br/>
<SiteType>M</SiteType><br/>
<Type>F</Type><br/>
<DWHSalesTerritoryID>5</DWHSalesTerritoryID><br/>
<SalesTerrRowID>ADOA-4VHJYK</SalesTerrRowID><br/>
<SiteID>ADOA-3ZVNEI</SiteID><br/>
<Channel>VS</Channel><br/>
<StartDate>2012-01-01T00:00:00.000</StartDate><br/>
<Brand>-</Brand><br/>
<Rank>6</Rank><br/>
<Delete/><br/>
<Update/><br/>
</row><br/>
</rows>

The tricky part (at least for me) is that I need to do pre-checking on the input based on business rules and I also need to create, on-the-fly, the output based on this set of rules where some values may be changed (format will be the same). I dont
want to talk about the business rules as this will only cloud what I am looking for. I need to be able to compare the current node with the values from the previous "output" node (with the updated values) and also with the next input node. I can
get at the next input node using an axis path but the only way I can think of getting the previous "output" node values would be with a call-template and parameter passing in a loop (I think). Sorry, but Im rather new to XSLT and would like to see if
there is a cleaner/better way.
Thanks in advance ...

View the full article
 
Back
Top