473,504 Members | 13,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to see if current element value matches previous

7 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0"?>
  2. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  3.  
  4. <xsl:output method="html"/>
  5.  
  6. <xsl:template match="/">
  7. <html>
  8. <body>
  9.     <table border="1" >
  10.         <thead>
  11.             <th bgcolor="rgb(70%,70%,70%)" width="250">Steps</th>
  12.             <xsl:for-each select="RecipeElement/Steps/Step/FormulaValue">
  13.                     <th bgcolor="rgb(70%,70%,70%)" width="250"><xsl:value-of select="Name"/></th>
  14.                </xsl:for-each>
  15.         </thead>
  16.  
  17.         <tbody>
  18.  
  19.                 <td><xsl:value-of select="RecipeElement/Steps/Step/Name"/></td>
  20.  
  21.              <xsl:for-each select="RecipeElement/Steps/Step/FormulaValue">
  22.                 <td width="250"><xsl:value-of select="Real"/></td>
  23.                </xsl:for-each>
  24.            </tbody>
  25.  
  26.  
  27.       </table>
  28. </body>
  29. </html>
  30.  
  31. </xsl:template>
  32. </xsl:stylesheet>
  33.  
XML code:
Expand|Select|Wrap|Line Numbers
  1. <Step XPos="600" YPos="598" AcquireUnit="true">
  2.             <Name>Step 1</Name>
  3.             <StepRecipeID>UFDF_CLEANING</StepRecipeID>
  4.             <UnitAlias>UFDF_CLEANING:1</UnitAlias>
  5.  
  6.             <FormulaValue>
  7.                 <Name>Name1A</Name>
  8.                 <Display>false</Display>
  9.                 <Value/>
  10.                 <Real>75</Real>
  11.                 <EngineeringUnits></EngineeringUnits>
  12.             </FormulaValue>
  13.  
  14.             <FormulaValue>
  15.                 <Name>Name2A</Name>
  16.                 <Display>false</Display>
  17.                 <Value/>
  18.                 <Real>35</Real>
  19.                 <EngineeringUnits></EngineeringUnits>
  20.             </FormulaValue>
  21.  
  22.             <FormulaValue>
  23.                 <Name>Name3A</Name>
  24.                 <Display>false</Display>
  25.                 <Value/>
  26.                 <Real>5.7</Real>
  27.                 <EngineeringUnits></EngineeringUnits>
  28.             </FormulaValue>
  29.         </Step>
  30.  
  31. <Step XPos="600" YPos="598" AcquireUnit="true">
  32.             <Name>Step 2</Name>
  33.             <StepRecipeID>UFDF_CLEANING</StepRecipeID>
  34.             <UnitAlias>UFDF_CLEANING:1</UnitAlias>
  35.  
  36.             <FormulaValue>
  37.                 <Name>Name1A</Name>
  38.                 <Display>false</Display>
  39.                 <Value/>
  40.                 <Real>75</Real>
  41.                 <EngineeringUnits></EngineeringUnits>
  42.             </FormulaValue>
  43.  
  44.             <FormulaValue>
  45.                 <Name>Name2A</Name>
  46.                 <Display>false</Display>
  47.                 <Value/>
  48.                 <Real>35</Real>
  49.                 <EngineeringUnits></EngineeringUnits>
  50.             </FormulaValue>
  51.  
  52.             <FormulaValue>
  53.                 <Name>Name3A</Name>
  54.                 <Display>false</Display>
  55.                 <Value/>
  56.                 <Real>5.7</Real>
  57.                 <EngineeringUnits></EngineeringUnits>
  58.             </FormulaValue>
  59.         </Step>
  60.  
  61. <Step XPos="600" YPos="598" AcquireUnit="true">
  62.             <Name>Step 3</Name>
  63.             <StepRecipeID>NEW IDENTIFICATION</StepRecipeID>
  64.             <UnitAlias>NewID</UnitAlias>
  65.  
  66.             <FormulaValue>
  67.                 <Name>Name1C</Name>
  68.                 <Display>false</Display>
  69.                 <Value/>
  70.                 <Real>75</Real>
  71.                 <EngineeringUnits></EngineeringUnits>
  72.             </FormulaValue>
  73.  
  74.             <FormulaValue>
  75.                 <Name>Name2C</Name>
  76.                 <Display>false</Display>
  77.                 <Value/>
  78.                 <Real>35</Real>
  79.                 <EngineeringUnits></EngineeringUnits>
  80.             </FormulaValue>
  81.  
  82.             <FormulaValue>
  83.                 <Name>Name3C</Name>
  84.                 <Display>false</Display>
  85.                 <Value/>
  86.                 <Real>5.7</Real>
  87.                 <EngineeringUnits></EngineeringUnits>
  88.             </FormulaValue>
  89.         </Step>
Jun 15 '07 #1
1 1265
Dököll
2,364 Recognized Expert Top Contributor

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:

http://www.w3schools.com/xsl/xsl_if.asp

Please write if more help is needed, Christine.

In a bit!
Jun 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
15418
by: TJ Walls | last post by:
Hello All, Is it possible to create a <select> element with no selected options? I have tried setting the selectedIndex attribute to -1, but as far as I can tell this only works for <select...
1
10079
by: Dave Hammond | last post by:
I have an html element (a link) with an onclick handler which opens a popup window, and would like to position that window at the coordinates where the element appears on the page. I have...
2
2202
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
1
2019
by: Andy Wells | last post by:
I'm using VB.NET and I have an application that binds a schema to the main form's controls, and the user has the ability to load an XML file through the schema and into the bound form. My...
8
12066
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
3
2115
by: Christopher Weaver | last post by:
I want to set a value in a specific field in the current row of a DataSet. This seems like the most basic thing to do but I can't find the syntax for identifying the current row. IOW, I can do...
4
9785
by: eksamor | last post by:
I have a simple linked list: struct element { struct element *next; int start; }; struct list { struct element *head;
4
2896
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a...
1
4325
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.