I have the following XML code (this is a snippet with what I am trying to work with).
<products>
<product>
<productname>Name2</productname>
<productsize measurement="ml">250</productsize>
<productsize measurement="ml">500</productsize>
<productsize measurement="ml">750</productsize>
<otherelements></otherelements>
<price size="250" packsize="1">1.25</price>
<price size="250" packsize="6">7.50</price>
<price size="250" packsize="12">7.00</price>
<price size="500" packsize="1">1.75</price>
<price size="500" packsize="6">10.50</price>
<price size="500" packsize="12">19.00</price>
<price size="750" packsize="1">2.25</price>
<price size="750" packsize="6">13.50</price>
<price size="750" packsize="12">25.00</price>
</product>
<product>
<productname>Name1</productname>
<productsize measurement="ml">250</productsize>
<productsize measurement="ml">750</productsize>
<otherelements></otherelements>
<price size="250" packsize="1">1.25</price>
<price size="250" packsize="6">7.50</price>
<price size="250" packsize="12">7.00</price>
<price size="750" packsize="1">2.25</price>
<price size="750" packsize="6">13.50</price>
<price size="750" packsize="12">25.00</price>
</product>
</products>
What I am trying to do is display it like this
250ml 1=£1.25, 6=£7.50, 12=£7.00
500ml 1=£1.75, 6=£10.50, 12=£19.00
750ml 1=£2.25, 6=£13.50, 12=£25.00
But it's no working and here is my XSL Code what and I doing wrong, I know it's got to do with the inner for loop.
<xsl:for-each select="x:productsize">
<p>
<xsl:value-of select="."/>
<xsl:value-of select="@measurement"/>
</p>
<xsl:for-each select="x:price">
<xsl:if test="productsize = '@size'">
<xsl:value-of select="."/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>