Quote:
quote:Originally posted by samjudson
You could try using group-ending-with="close" then you will have a group of items, the last of which will always be a close element.
|
If I write group-ending-with="close" then this will group based on first occurence of <close>.In the given case, there can be more than one <close>....</close>. I want to end my group where a <close> is followed by <book.content> and that can happen after 2-3 occurences of <close>.
Also, is it correct that we cannot use both group-starting with and group-ending-with together, as they are mutually exclusive. Because, if there are some other elements apart from <book.content> and <close> then I don't wish to group them. Like in given example I wdon't wish to group <myname> node.
For example: In this case I want to leave <myname>Trishla</myname> as it is and would like to wrap all occurences of <book.content> and <close> in one big wrap called <book.content> with the condition that the big wrap will close wherever a <book.content> is preceded by <close> and after that a new <book.content> will start.
<books>
<myname>trishla</myname>
<book.content>
<Topic>ABC</Topic>
<author>123</author>
</book.content>
<book.content>
<Topic>DEF</Topic>
<author>456</author>
</book.content>
<close>
<Index>aaa</index>
<pages>111</pages>
<Noname>
<useless>one</useless>
</Noname>
</close>
<close>
<Index>bbb</index>
<pages>222</pages>
</close>
<book.content>
<Topic>GHI</Topic>
<author>789</author>
</book.content>
<books>
Output:
<books>
<myname>trishla</myname>
<book.content>
<Topic>ABC</Topic>
<author>123</author>
<s></book.content></s>
<s><book.content></s> <Topic>DEF</Topic>
<author>456</author>
<s></book.content></s>
<close>
<Index>aaa</index>
<pages>111</pages>
<Noname>
<useless>one</useless>
</Noname>
</close>
<close>
<Index>bbb</index>
<pages>222</pages>
</close>
</book.content>
<book.content>
<Topic>GHI</Topic>
<author>789</author>
</book.content>
<books>