Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Comma separated list using XPath >Thread Next - Re: Comma separated list using XPath Re: Comma separated list using XPathTo: NULL Date: 12/4/2007 11:16:00 AM Hi Guys Thanks for all the input. Dimitre, your suggestion is something I had tried as well. Unfortunately I don't think it quite works... Well, more specially it *does* work for the one example I posted, but imagine if I added another book below the last one with the author Mary. (I put an updated XML snippet below) The the output for John is: 1, 3, 5, (Since the 5th book is no longer the last book overall, a comma is added after the 5.) The reason I am trying to use XPath is I am being forced to use Altova StyleVision for this project, and as far as I am aware, StyleVision won't let me do this any other way (i.e. using the XLST or XQuery). After I posted this, I realized the problem is actually more complicated than I had previously thought. The point is actually to create a detailed list of books, sorted by title (title is just another element inside book) with a summary on top telling which books below correspond to the given authors by the position the book appears in the report. I put an example below. So I don't know if this is going to be possible. If anyone has any other thoughts, either for the first problem as an intellectual exercise, or to the 'revised' situation--including using XSLT or XQuery--that'd be great. Otherwise thanks for all the input! Output example Books by John: 1, 2, 5 Books by Mary: 3, 6 Books by Mark: 4 Book 1: Title: A Book Title Starting With 'A' Author: John Book 2: Title: Books Are Fun! Author: John Book 3: Title: Can You Tell Me How To Get To Sesame Street? Author Mary ... XML Example <?xml version="1.0" encoding="UTF-8"?> <Library> <Branch> <book> <author>John</author> </book> <book> <author>Mary</author> </book> </Branch> <Branch> <book> <author>John</author> </book> <book> <author>Mark</author> </book> <book> <author>John</author> </book> <book> <author>Mary</author> </book> </Branch> </Library> On Dec 2, 10:26 pm, "Dimitre Novatchev" <dimit...@tpg.com.au> wrote: > "Joe Kesselman" <keshlam-nos...@comcast.net> wrote in message > > news:gqmdnXmD4cUuFszanZ2dnUVZ_tLinZ2d@c...... > > >> /(if(author='John') > > > I believe if/then/else expressions require XPath 2.0 or XQuery. If that's > > what you have available, go for it; > > Yes, this was the code in the OP first post. > > Cheers, > Dimitre Novatchev | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
