473,657 Members | 2,395 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 1278
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
15453
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 multiple> elements. Am I missing something obvious? Sincerely, TJ Walls
1
10113
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 installed a document.onclick event handler which saves the eventX and eventY values, then use those values to set the window top/left coordinates. The problem is that the eventX and eventY values always seem to be the previous coordinates, not the...
2
2212
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 setting that tell the process that the new top of the document region is now at the end of the last block-container used, this must be set in that last block container. 3. find the value used in the 'top" setting on the prior
1
2034
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 problem is this: the schema contains an element called "TRENDED" and it has an attribute called "type" whose value can be "previous" or "current". This element can occur twice in the XML, once with the attribute-value "previous" and a second time with...
8
12088
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 combobox. What is the solution? Thank you in advance.
3
2124
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 this: SomeRow = 'value'; But how do I set SomeRow to the row that the user is currently viewing?
4
9820
by: eksamor | last post by:
I have a simple linked list: struct element { struct element *next; int start; }; struct list { struct element *head;
4
2913
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 child element with an attribute set at a given value; maybe an example is more self-explaining... Given the following input XML document:
1
4333
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 logic for a date field. i.e. theValue.defaultvalue = "#" & theValue.value & "#" I can't get this to work for some reason and I can't figure out why. Can anyone out there help? Thanks Repeat value of previous record field into current...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.