Subject:XSLT and Array Author:Dink Lo Date:10 Aug 2006 03:16 AM
Hi all,
I'm new in the XSLT field. I have a strange problem and it seems to need something like array in the XSLT style.
This is my XML:
<WorkList>
<Item>
<Name>aaa</Name>
<Quantity>10</Quantity>
</Item>
<Item>
<Name>bbb</Name>
<Quantity>5</Quantity>
</Item>
</WorkList>
<SubTotalList>
<Detail>
<UnitPrice>10</UnitPrice>
<Amount>100</Amount>
</Detail>
<Detail>
<UnitPrice>5</UnitPrice>
<Amount>25</Amount>
</Detail>
</SubTotalList>
The XML needs to be presented like this:
Name Quantity UnitPrice Amount
aaa 10 10 100
bbb 5 5 25
I think the pseudo code of the XSLT should be like:
<xsl:for-each select="WorkList/Item">
<TR>
<TD><xsl:value-of select="Name"/></TD>
<TD><xsl:value-of select="Quantity"/></TD>
<TD>SubTotalList.Detail[i].UnitPrice</TD>
<TD>SubTotalList.Detail[i].Amount</TD>
i++;
</TR>
</xsl:for-each>
However I can't find the mapping XSLT presentation to the pseudo code. Can somebody help me to make the XSLT presentation?
Subject:XSLT and Array Author:Dink Lo Date:10 Aug 2006 09:39 PM
Hi James,
Thanks for your suggestion.
However the XML schema is defined and it's better not to change it.
So I need to make up a XSLT stylesheet to complement the bad defined XML Schema. Can you give me some advice?