Z
Zhang Weiwu
Dear all
As a newbie I don't know how to describe my issue clearly in right term.
I have read books about XSLT but I cannot find a way to do this kind of
transformation:
The system A produce XML output like this:
<branch name="shopA">
<yearly_revenue year="2006">
<categoryA>123000</category>
<categoryB>124000</category>
</yearly>
<yearly_revenue year="2007">
<categoryA>125000</category>
<categoryB>126000</category>
</yearly>
</branch>
<branch name="shopB">
<yearly_revenue year="2006">
<categoryA>123000</category>
<categoryB>124000</category>
</yearly>
<yearly_revenue year="2007">
<categoryA>125000</category>
<categoryB>126000</category>
</yearly>
</branch>
And system B take input XML like this:
<yearly_revenue year="2006">
<branch name="shopA">
<categoryA>123000</category>
<categoryB>124000</category>
</branch>
<branch name="shopB"
<categoryA>123000</category>
<categoryB>124000</category>
</branch>
</yearly_revenue>
<yearly_revenue year="2007">
<branch name="shopA">
<categoryA>125000</category>
<categoryB>126000</category>
</branch>
<branch name="shopB"
<categoryA>125000</category>
<categoryB>126000</category>
</branch>
</yearly_revenue>
Generally, the 'relationship' or how to categorize data, is changed.
The output XML file categorize by shops first, and by year second.
The second XML file cateogrize by year first, and by shop second.
I am not sure if XSLT can handle such transformation? Would be easy with
SQL with distinct selection, but probably is the weakness of XSLT
comparing to SQL? I could not find a 'select distinct' operation in XSLT
which would be necessary to do this kind of transformation.
Best regards and thanks in advance for hints!
Zhang Weiwu
As a newbie I don't know how to describe my issue clearly in right term.
I have read books about XSLT but I cannot find a way to do this kind of
transformation:
The system A produce XML output like this:
<branch name="shopA">
<yearly_revenue year="2006">
<categoryA>123000</category>
<categoryB>124000</category>
</yearly>
<yearly_revenue year="2007">
<categoryA>125000</category>
<categoryB>126000</category>
</yearly>
</branch>
<branch name="shopB">
<yearly_revenue year="2006">
<categoryA>123000</category>
<categoryB>124000</category>
</yearly>
<yearly_revenue year="2007">
<categoryA>125000</category>
<categoryB>126000</category>
</yearly>
</branch>
And system B take input XML like this:
<yearly_revenue year="2006">
<branch name="shopA">
<categoryA>123000</category>
<categoryB>124000</category>
</branch>
<branch name="shopB"
<categoryA>123000</category>
<categoryB>124000</category>
</branch>
</yearly_revenue>
<yearly_revenue year="2007">
<branch name="shopA">
<categoryA>125000</category>
<categoryB>126000</category>
</branch>
<branch name="shopB"
<categoryA>125000</category>
<categoryB>126000</category>
</branch>
</yearly_revenue>
Generally, the 'relationship' or how to categorize data, is changed.
The output XML file categorize by shops first, and by year second.
The second XML file cateogrize by year first, and by shop second.
I am not sure if XSLT can handle such transformation? Would be easy with
SQL with distinct selection, but probably is the weakness of XSLT
comparing to SQL? I could not find a 'select distinct' operation in XSLT
which would be necessary to do this kind of transformation.
Best regards and thanks in advance for hints!
Zhang Weiwu