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. XML Xpath Xquery

XML Xpath Xquery

Scheduled Pinned Locked Moved XML / XSL
databasexmltutoriallearning
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.
  • C Offline
    C Offline
    Capatain galaxy
    wrote on last edited by
    #1

    Hi Guys This a ticklish one and espite hunting around the web I cannot find an answer. Basically what I would like to do is to extract a single instance of any node. For example imagine an XMl file which contains loads of books, authors and keywords for each book. What I would like to do is to extract a single intance of each author. If you like you could call it an index. any pointers would be immensley useful. for the more SQL orientated the relevant code code would be select distinct author from books. Thanks in advance CQ

    D 1 Reply Last reply
    0
    • C Capatain galaxy

      Hi Guys This a ticklish one and espite hunting around the web I cannot find an answer. Basically what I would like to do is to extract a single instance of any node. For example imagine an XMl file which contains loads of books, authors and keywords for each book. What I would like to do is to extract a single intance of each author. If you like you could call it an index. any pointers would be immensley useful. for the more SQL orientated the relevant code code would be select distinct author from books. Thanks in advance CQ

      D Offline
      D Offline
      Dustin Metzgar
      wrote on last edited by
      #2

      In this case, XSL is a little weak. There is a distinct-values[^] function in XPath 2. Microsoft doesn't like XPath 2 and has decided not to support it. You can use another parser like XmlSpy and it will work fine.  If you're using an XSLT, you can do a sort on a for-each so you could get all the like author names together, but that's about it.

      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