RE: [xsl] Condition Based Count of Sections

Subject: RE: [xsl] Condition Based Count of Sections
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 13 Apr 2007 12:43:10 +0100
Thanks, but as I explained, I can't infer your rules from your example. I
asked one specific question that you haven't answered: why is the chapter
numbered 1.1 rather than 1?

I experimented with a number of variations, and I couldn't find any logic
for the numbering you were using. If you want any further help, you'll have
to explain the logic you were using much more clearly.

We always ask people to give an example showing the input and the output,
but sometimes one example just isn't enough to infer the transformation
rules.

Also, using nicely indented XML also makes it much easier for people to see
what's going on.

This is an area, incidentally, where as far as I can see there's no great
advantage in using XSLT 2.0 rather than 1.0. And contrary to what Abel said,
I think there's nothing in my stylesheet that depends on XSLT 2.0.

Michael Kay
http://www.saxonica.com/


> Below is output of your effort
> 
> <chapter count="1" level="1">
> <ti>Chapter title</ti>
> <p>PC DATA IS HERE</p>
> <p>PC DATA IS HERE</p>
> <sect1 count="2" level="1.2">
> <ti>SECT1: SECTION TITLE</ti>
> <sect2 count="2" level="1.1.1">
> <ti>SECT2: SECTION TITLE</ti>
> <p>Paragraph 1: PC DATA IS HERE</p>
> <p>Paragraph 2: PC DATA IS HERE</p>
> </sect2>
> ...
> 
> It is towards the direction but
> 1. <sect2> should not count because its parent <sect1> does 
> not have any <p>
> 
> OUTPUT should be
> <chapter count="1" level="1.1">
> <ti>Chapter title</ti>
> <p>PC DATA IS HERE</p>
> <p>PC DATA IS HERE</p>
> <sect1 count="2" level="1.1.1">
> <ti>SECT1: SECTION TITLE</ti>
> <sect2>
> <ti>SECT2: SECTION TITLE</ti>
> <p>Paragraph 1: PC DATA IS HERE</p>
> <p>Paragraph 2: PC DATA IS HERE</p>
> </sect2>
> ...

Current Thread