xsl-list
[Top] [All Lists]

[xsl] Debug/QC Stylesheets

2008-06-04 08:00:39
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/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>