Good afternoon Quick intro: I'm new here, I'm nic, I abuse and manipulate data (often in XML) for a living, right now I work for Penguin Books. I have a debug stylesheet I use to give me a quick overview of xml we get in from data converters. Right now, it dumps out an html list containing the large scale structure of the xml (it's a DocBook 5 variant) down to chapter level. Below that level it counts various elements (paras, blockquotes, sections, etc). Our QC people use this script too. This morning, one of them asked me if I could update it so that, rather than outputting something like: chapter: 24 paragraphs 3 sections 2 tables it could output something like: 3 paragraphs 1 section 2 paragraphs 1 table 3 paragraphs That is it would output the fact that the document contains 3 paras then 1 section (which contains 2 paras) then 1 table then 3 more paras. Initially, I thought 'dead easy' then I had a bit more of a think and realised that it probably isn't. Right now, I just use something like count(descendant::para) get my output. Obviously, that no longer works. Then, I thought that I could probably use following-sibling to get the requested output. Then I realised that it's not that simple either. So, the question. Am I wandering down a path that might be easier to traverse using DOM or SAX? If not, can anyone point me in the direction of something similar or suggest an approach? I have a suspicion that I'm missing something obvious. cheers nic -- Nic Gibson Director, Corbas Consulting Editorial and Technical Consultancy http://www.corbas.co.uk/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format