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. XPath question

XPath question

Scheduled Pinned Locked Moved XML / XSL
xmlquestiondatabasealgorithmssales
5 Posts 3 Posters 2 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.
  • M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    Let's say I have a complex type defined in the schema: The corresponding XML looks something like this: CalcItemTax Determine the tax on the item CalculateItemTax TaxExempt Flag indicating customer is tax exempt Taxable Flag indicating item is taxable Is there a single XPath statement I can use to extract just the DataSetName and the DSREvent, for example, with both returned as children IN THE SAME NODE??? If I use the '|' operator, I get two nodes for every line. Any ideas? Thanks, Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
    Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
    Every line of code is a liability - Taka Muraoka
    Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"

    M 1 Reply Last reply
    0
    • M Marc Clifton

      Let's say I have a complex type defined in the schema: The corresponding XML looks something like this: CalcItemTax Determine the tax on the item CalculateItemTax TaxExempt Flag indicating customer is tax exempt Taxable Flag indicating item is taxable Is there a single XPath statement I can use to extract just the DataSetName and the DSREvent, for example, with both returned as children IN THE SAME NODE??? If I use the '|' operator, I get two nodes for every line. Any ideas? Thanks, Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
      Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
      Every line of code is a liability - Taka Muraoka
      Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"

      M Offline
      M Offline
      Michael A Barnhart
      wrote on last edited by
      #2

      If I am reading your question right, I think you want to look at the usage of ... to create the data for a single new element that combines the data from the two you had. If you are wanting the elements then I do not understand your question because you do have two elements (or nodes) before and after. edited (check display as is stupid!) "I will find a new sig someday."

      M 1 Reply Last reply
      0
      • M Michael A Barnhart

        If I am reading your question right, I think you want to look at the usage of ... to create the data for a single new element that combines the data from the two you had. If you are wanting the elements then I do not understand your question because you do have two elements (or nodes) before and after. edited (check display as is stupid!) "I will find a new sig someday."

        M Offline
        M Offline
        Marc Clifton
        wrote on last edited by
        #3

        Well..., I guess I'm confused. Is XPath and XSL interchangeable? I'm not sure how to set up an XSL query in C# using the XmlDataDocument.SelectNodes method (and I don't really want to get into implementation specifics, I just want to figure out the right XPath command, if one exists!). At this point, I don't even know what the right question is to ask. I basically want something that returns an XmlNode with two children--the DataSetName text field and the DSREvent text field. Seems this shouldn't be so dang hard, and if it's not possible, this seems like a real limitation of XPath. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
        Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
        Every line of code is a liability - Taka Muraoka
        Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"

        M 1 Reply Last reply
        0
        • M Marc Clifton

          Well..., I guess I'm confused. Is XPath and XSL interchangeable? I'm not sure how to set up an XSL query in C# using the XmlDataDocument.SelectNodes method (and I don't really want to get into implementation specifics, I just want to figure out the right XPath command, if one exists!). At this point, I don't even know what the right question is to ask. I basically want something that returns an XmlNode with two children--the DataSetName text field and the DSREvent text field. Seems this shouldn't be so dang hard, and if it's not possible, this seems like a real limitation of XPath. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
          Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
          Every line of code is a liability - Taka Muraoka
          Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"

          M Offline
          M Offline
          Michael A Barnhart
          wrote on last edited by
          #4

          Marc Clifton wrote: Is XPath and XSL interchangeable? The straight answer to that is no. XPath is a thecnique that is used in XSL transformation to identify what it is to work on. Now that what can be in respect to the whole document. I.E. what element to start with and it can be relative to its starting point or the element it that is currently the reference point. Once you have identified a starting element you can copy elements in whole or create new element and then assign data to those elements (new or the copied ones). One method of getting data from existing XML is the value-of Now to confuse you. internal to the value-f is a select option that you may say what data you want. And guess what, you can use the XPath in that select statement. At this point I am probably getting you fairly confused, sorry. Do you have any XSLT reference books? It may be a worth while effort to get one. Michael Kays is a good book and amazon has it for I think $25. I do not have it just because one of "my guys" has it. Or I would have purchased it. The other book I would recommend is Holzners Inside XSLT book from New Riders. It is not as good in the explaination but is better with samples. It also is found in the used area on amazon for under $10. (6.98) I will be happy to continue if I am helping you. I will be honest though, I have been leading a group now for about 18 months and they do the day to day coding and I am getting rusty. "I will find a new sig someday."

          N 1 Reply Last reply
          0
          • M Michael A Barnhart

            Marc Clifton wrote: Is XPath and XSL interchangeable? The straight answer to that is no. XPath is a thecnique that is used in XSL transformation to identify what it is to work on. Now that what can be in respect to the whole document. I.E. what element to start with and it can be relative to its starting point or the element it that is currently the reference point. Once you have identified a starting element you can copy elements in whole or create new element and then assign data to those elements (new or the copied ones). One method of getting data from existing XML is the value-of Now to confuse you. internal to the value-f is a select option that you may say what data you want. And guess what, you can use the XPath in that select statement. At this point I am probably getting you fairly confused, sorry. Do you have any XSLT reference books? It may be a worth while effort to get one. Michael Kays is a good book and amazon has it for I think $25. I do not have it just because one of "my guys" has it. Or I would have purchased it. The other book I would recommend is Holzners Inside XSLT book from New Riders. It is not as good in the explaination but is better with samples. It also is found in the used area on amazon for under $10. (6.98) I will be happy to continue if I am helping you. I will be honest though, I have been leading a group now for about 18 months and they do the day to day coding and I am getting rusty. "I will find a new sig someday."

            N Offline
            N Offline
            Nitron
            wrote on last edited by
            #5

            I didn't know you were so into XML. Maybe another Soda Springs venture may be in order... :suss: - Nitron


            "Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb

            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