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