Simple XSL

Hi ,

Please find the sample XML attached..

I want all the value attributes along with name.

eg:
SB25A Retail Price 23.36
SB25A Item Class 03009
SB25A Item Group 03
etc
etc
till last value tag

I tried the below , but it provide me only the 1st row .

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
    <h2>My CD Collection</h2>
    <table border="1">
      <tr bgcolor="#9acd32">
<th>Name</th>
        <th>DATA</th>
        <th>VALUE</th>
               </tr>
      <xsl:for-each select="STEP-ProductInformation/Products">
      <tr>
<td><xsl:value-of select="./Product/Name" /></td>

        <td><xsl:value-of select="./Product/Values/Value/@AttributeID" /></td>
        <td><xsl:value-of select="./Product/Values/Value[@AttributeID]" /></td>
        </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>
0

Open in new window

sample.xml
LVL 5
magentoAsked:
Who is Participating?
 
zc2Commented:
Try this:
      <xsl:for-each select="/STEP-ProductInformation/Products/Product/Values/Value">
      <tr>
        <td><xsl:value-of select="../../Name" /></td>
        <td><xsl:value-of select="@AttributeID" /></td>
        <td><xsl:value-of select="." /></td>
        </tr>
      </xsl:for-each>

Open in new window

0
 
magentoAuthor Commented:
I am getting all the values in a single cell.

DATA      VALUE
                                 23.36 03009 50 gr. SB25A

Thanks
0
 
magentoAuthor Commented:
Apologies, i ran it wrong. Its working fine.
0
 
magentoAuthor Commented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.