You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Eva Flora <ev...@bluemartini.com> on 2001/01/26 07:22:09 UTC

for-each select question

I am not having any luck with the "for-each" for the document
I have. Below is my sample xml.in file that I want to transform
and the xml.out file that I want to generate.  How do I specify
to loop through all Products[i]?

Thanks in advance,
Eva

<xsl:for-each select="Product[i]">
    <Product>
       <A><xsl:value-of select="/Product[i]/A"/></A>
       <B><xsl:value-of select="/Produc[i]t/B"/></B>
       <C><xsl:value-of select="/Product[i]/C"/></C>
    </Product>
</xsl:for-each>
=============xml.in============
       <Product1>
            <A>ACC101</A>
            <B">175.00</B>
            <C>Monitor Arm</C>
        </Product1>
        <Product2>
            <A>ACC301</A>
            <B">200.00</B>
            <C>Monitor Lift</C>
        </Product2>
        <Product3>
            <A>ACC302</A>
            <B>150.00</B>
            <C>Processor Sling</C>
        </Product3>
=============xml.out============
       <Product>
            <A>ACC101</A>
            <B">175.00</B>
            <C>Monitor Arm</C>
        </Product>
        <Product>
            <A>ACC301</A>
            <B">200.00</B>
            <C>Monitor Lift</C>
        </Product>
        <Product>
            <A>ACC302</A>
            <B>150.00</B>
            <C>Processor Sling</C>
        </Product>