how to see if current element value matches previous

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • redgrL86
    New Member
    • Jun 2007
    • 7

    how to see if current element value matches previous

    Hi,
    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:
    Code:
    <?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>
    XML code:
    Code:
    <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>
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by redgrL86

    Sorry for the long description but it is hard to explain. Please help me!!
    Thanks,
    Christine
    You're doing fine, Christine!

    Sometimes thorough, somewhat lengthy description is good...

    Couldn't simply adding additional column headers fit your purpose? I am understanding that some IDs are not the same. I also wondered if an if statement could help spin it in the right direction:

    Sorry! We can't seem to find the resource you're looking for


    Please write if more help is needed, Christine.

    In a bit!
    Last edited by Dököll; Jun 28 '07, 01:35 AM. Reason: Deleted text and code

    Comment

    Working...