[Home] [By Thread] [By Date] [Recent Entries]
Dear List- I have discussed this issue earlier with you. In that time I have not elaborated the logic and not got the right solution. It seems little bit complex and I think we should use global variable but not sure. The logic is based on DocBook's chunking rules. Below are the key points of the logic: 1. We are counting chunks of following elements <chapter>, <sect1>, <sect2> and <sect3> 2. Count- It is count of those chunks which contains content. 3. Level - It is hierarchical number of the chunk (e.g. 1, 1.1, 1.2, 1.2.1, etc) to enable the output file to be re-assembled in a hierarchical structure. 4. A rule should be devised that will prevent empty chunk being generated. For example, the following XML would generate empty pages for the <book> and <chapater> as they have no content. This is something we need to avoid when the XSLT is devised, perhaps by combining lower content into an empty chunk. Note: Please read the comments of OUTPUT for better understanding INPUT <book> <chapter count="1" level="1.1"><title>TITLE</title> <sect1><title>TITLE</title> <sect2><title>TITLE</title> <sect3><title>TITLE</title> <p>Text Text Text Text</p> </sect3> </sect2> </sect1> <sect1 count="2" level="1.1.1"><title>TITLE</title> <sect2><title>TITLE</title> <p>Text Text Text Text</p> </sect2> <sect2 count="3" level="1.1.1.1"><title>TITLE</title> <p>Text Text Text Text</p> </sect2> </sect1> <sect1 count="4" level="1.1.2"><title>TITLE</title> <p>Text Text Text Text</p> <sect2 count="5" level="1.1.2.1"><title>TITLE</title> <p>Text Text Text Text</p> <sect3 count="6" level="1.1.2.1.1"><title>TITLE</title> <p>Text Text Text Text</p> </sect3> </sect2> </sect1> <sect1 count="7" level="1.1.3"><title>TITLE</title> <p>Text Text Text Text</p> </sect1> </chapter> <chapter count="8" level="1.2"><title>TITLE</title> <sect1><title>TITLE</title> <p>Text Text Text Text</p> </sect1> </chapter> </book> OUTPUT <book> <!-- In this chunk <chapter>, <sect1> and <sect2> don't have data i.e. <p> and data is only within <sect3>. Therefore it is the first chunk (count=1) and depth (level=1.1 i.e. count of book + occurrence of chapter within book)--> <chapter count="1" level="1.1"><title>TITLE</title> <sect1><title>TITLE</title> <sect2><title>TITLE</title> <sect3><title>TITLE</title> <p>Text Text Text Text</p> </sect3> </sect2> </sect1> <!-- In this chunk <sect1> don't have data i.e. <p> and data is only within <sect2>. Therefore it is the second chunk (count=2) and depth (level=1.1.1 ie. level of chapter + occurrence count within chapter)--> <sect1 count="2" level="1.1.1"><title>TITLE</title> <sect2><title>TITLE</title> <p>Text Text Text Text</p> </sect2> <!-- In this chunk <sect2> have data. Therefore it is the third chunk (count=3) and depth (level=1.1.1.1 ie. level of sect1 + occurrence count within sect1)--> <sect2 count="3" level="1.1.1.1"><title>TITLE</title> <p>Text Text Text Text</p> </sect2> </sect1> <!-- In this chunk <sect1> have data. Therefore, it is the forth chunk (count=4) and depth (level=1.1.2 ie. level of sect1 + occurrence count within chapter)--> <sect1 count="4" level="1.1.2"><title>TITLE</title> <p>Text Text Text Text</p> <!-- In this chunk <sect2> have data. Therefore, it is the fifth chunk (count=5) and depth (level=1.1.2.1 ie. level of sect1 + occurrence count within sect1)--> <sect2 count="5" level="1.1.2.1"><title>TITLE</title> <p>Text Text Text Text</p> <!-- In this chunk <sect3> have data. Therefore, it is the sixth chunk (count=6) and depth (level=1.1.2.1.1 ie. level of sect2 + occurrence count within sect2)--> <sect3 count="6" level="1.1.2.1.1"><title>TITLE</title> <p>Text Text Text Text</p> </sect3> </sect2> </sect1> <!-- In this chunk <sect1> have data. Therefore, it is the seventh chunk (count=7) and depth (level=1.1.3 ie. level of sect1 + occurrence count within chapter)--> <sect1 count="7" level="1.1.3"><title>TITLE</title> <p>Text Text Text Text</p> </sect1> </chapter> <!-- In this chunk <sect1> have data. Therefore, it is the eighth chunk (count=8) and depth (level=1.2 ie. count of book + occurrence chapter within book)--> <chapter count="8" level="1.2"><title>TITLE</title> <sect1><title>TITLE</title> <p>Text Text Text Text</p> </sect1> </chapter> </book>
|

Cart



