xsl-list
[Top] [All Lists]

Re: how can i get a sub-tree(between two chapter)

2003-06-25 06:25:54
this is my xml file:
......
<docbody>
<chap1><ht>title1</ht>
<para>para1</para>
<para>para2</para>
<list type="unnum">
<item><i-text>aaaa</i-text>
</item>
<item><i-text>bbb</i-text>
</item>
</list>
<para>cccc</para>
<chap2><ht>title2</ht>
<chap3><ht>title3</ht>
<para>ddd</para>
<list type="unnum">
<item><i-text>eee</i-text>
</item>
<item><i-text>fff</i-text>
</item>
</list>
</chap3>
<chap3><ht>title4</ht>
<para>ggg</para>
<list type="unnum">
<item><i-text>hhh</i-text>
</item>
<item><i-text>iii</i-text>
</item>
<item><i-text>jjj</i-text>
</item>
<item><i-text>kkk</i-text>
</item>
</list>
<notesect type="note"><para>lll</para>
</notesect>
</chap3>
</chap2>
<chap2><ht>title5</ht>
<para></para>
<notesect type="note"><list type="unnum">
<item><i-text>mmm</i-text>
</item>
<item><i-text>nnn</i-text>
</item>
</list>
</notesect>
</chap2>
</chap1>
</docbody>
......

and i want to cut the file to parts(each part is limited by onther chap) :
 part1:
-----
<chap1><ht>title1</ht>
<para>para1</para>
<para>para2</para>
<list type="unnum">
<item><i-text>aaaa</i-text>
</item>
<item><i-text>bbb</i-text>
</item>
</list>
<para>cccc</para>

part2:
-----
<chap2><ht>title2</ht>

part3:
-----
<chap3><ht>title3</ht>
<para>ddd</para>
<list type="unnum">
<item><i-text>eee</i-text>
</item>
<item><i-text>fff</i-text>
</item>
</list>
</chap3>

part4:
-----
<chap3><ht>title4</ht>
<para>ggg</para>
<list type="unnum">
<item><i-text>hhh</i-text>
</item>
<item><i-text>iii</i-text>
</item>
<item><i-text>jjj</i-text>
</item>
<item><i-text>kkk</i-text>
</item>
</list>
<notesect type="note"><para>lll</para>
</notesect>
</chap3>

part5:
-----
<chap2><ht>title5</ht>
<para></para>
<notesect type="note"><list type="unnum">
<item><i-text>mmm</i-text>
</item>
<item><i-text>nnn</i-text>
</item>
</list>
</notesect>
</chap2>

is it possible?

Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com a écrit :

Hi,

...

and i want for each chapter get its length,so how can i get a
sub-tree(between two chapter) in this file like:

-for chapter1:

chap1
         |---ht
         |---(para|list|notesect)*

-for chapter2:

 |---chap2
             |---ht
             |---(para|list|notesect)*

-for chapter3:

 |---chap3
             |---ht
             |---(para|list|notesect)*

I have to admit I don't understand the notation you use above, or rather your 
question, but if you're trying to flatten the structure, see 
<http://www.dpawson.co.uk/xsl/sect2/flatten.html>. In the future, it might be 
easier for people if you showed your source document as a plain, 
stripped-down, XML document, or e.g. your RelaxNG schema instead of ASCII art 
hierarchy picture.

Cheers,

Jarno - VNV Nation: Honour 2003 <http://synthetic.org/play.html>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list