Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. For-each loops

For-each loops

Scheduled Pinned Locked Moved XML / XSL
xmlcsharpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dwayner79
    wrote on last edited by
    #1

    I am new to XML, and am having trouble switching back and forth between c# and XML. The foreach loop is not functioning as I would expect. I have a foreach loop inside of another foreach loop. My goal was to say for each step, grab the name and block from each parameter in that step. Instead, it grabs all the step names, then all the parameter info. Is there a child nodes only type function for the for each loop? Here is a sample from my XML: Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Here is an excert from my xsl:

    Step Name:

    Thanks in advance ***************** "We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW

    H 1 Reply Last reply
    0
    • D Dwayner79

      I am new to XML, and am having trouble switching back and forth between c# and XML. The foreach loop is not functioning as I would expect. I have a foreach loop inside of another foreach loop. My goal was to say for each step, grab the name and block from each parameter in that step. Instead, it grabs all the step names, then all the parameter info. Is there a child nodes only type function for the for each loop? Here is a sample from my XML: Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 Here is an excert from my xsl:

      Step Name:

      Thanks in advance ***************** "We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW

      H Offline
      H Offline
      hp108
      wrote on last edited by
      #2

      I just ran your xml/xsl in cooktop and it gave me the correct result -

      Step Name: First step

      Cal sps 1 153 Cal sps 1 153 Cal sps 1 153

      Step Name: another step

      Cal sps 1 153 Cal sps 1 153 Cal sps 1 153 ------ I did not see the DOC element in your xml - so the only change I made is: To me your loops should work the way you want!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups