I am trying to create a table to display the values in the XML below. THe XSL provided works on the XML when there is only one <Step> but not three. Of the three steps in the XML below, two have the same table column headers (found in <FormulaValue> <Name>) and also the same <StepRecipeID>. The third step has different column headers and a different StepRecipeID.
So my question is: how do I tell the XSL to make new table column headers only for the Steps that have new StepRecipeID 's and not for the StepRecipeID's that are not new (that are the same as the previous StepRecipeID)?
Sorry for the long description but it is hard to explain. Please help me!!
Thanks,
Christine
XSL code:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="html"/>
- <xsl:template match="/">
- <html>
- <body>
- <table border="1" >
- <thead>
- <th bgcolor="rgb(70%,70%,70%)" width="250">Steps</th>
- <xsl:for-each select="RecipeElement/Steps/Step/FormulaValue">
- <th bgcolor="rgb(70%,70%,70%)" width="250"><xsl:value-of select="Name"/></th>
- </xsl:for-each>
- </thead>
- <tbody>
- <td><xsl:value-of select="RecipeElement/Steps/Step/Name"/></td>
- <xsl:for-each select="RecipeElement/Steps/Step/FormulaValue">
- <td width="250"><xsl:value-of select="Real"/></td>
- </xsl:for-each>
- </tbody>
- </table>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
Expand|Select|Wrap|Line Numbers
- <Step XPos="600" YPos="598" AcquireUnit="true">
- <Name>Step 1</Name>
- <StepRecipeID>UFDF_CLEANING</StepRecipeID>
- <UnitAlias>UFDF_CLEANING:1</UnitAlias>
- <FormulaValue>
- <Name>Name1A</Name>
- <Display>false</Display>
- <Value/>
- <Real>75</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- <FormulaValue>
- <Name>Name2A</Name>
- <Display>false</Display>
- <Value/>
- <Real>35</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- <FormulaValue>
- <Name>Name3A</Name>
- <Display>false</Display>
- <Value/>
- <Real>5.7</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- </Step>
- <Step XPos="600" YPos="598" AcquireUnit="true">
- <Name>Step 2</Name>
- <StepRecipeID>UFDF_CLEANING</StepRecipeID>
- <UnitAlias>UFDF_CLEANING:1</UnitAlias>
- <FormulaValue>
- <Name>Name1A</Name>
- <Display>false</Display>
- <Value/>
- <Real>75</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- <FormulaValue>
- <Name>Name2A</Name>
- <Display>false</Display>
- <Value/>
- <Real>35</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- <FormulaValue>
- <Name>Name3A</Name>
- <Display>false</Display>
- <Value/>
- <Real>5.7</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- </Step>
- <Step XPos="600" YPos="598" AcquireUnit="true">
- <Name>Step 3</Name>
- <StepRecipeID>NEW IDENTIFICATION</StepRecipeID>
- <UnitAlias>NewID</UnitAlias>
- <FormulaValue>
- <Name>Name1C</Name>
- <Display>false</Display>
- <Value/>
- <Real>75</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- <FormulaValue>
- <Name>Name2C</Name>
- <Display>false</Display>
- <Value/>
- <Real>35</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- <FormulaValue>
- <Name>Name3C</Name>
- <Display>false</Display>
- <Value/>
- <Real>5.7</Real>
- <EngineeringUnits></EngineeringUnits>
- </FormulaValue>
- </Step>