[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] transforming attributes into nested lists

Subject: [xsl] transforming attributes into nested lists
From: Paul Tremblay <phthenry@xxxxxxxxxxxxx>
Date: Fri, 16 Aug 2002 15:31:35 -0400

[Yes, this email is a repeat of the last eamil,
which I accidently sent without a subject. Sorry.]

How difficult it is to transform attributes into nestd lists?

I have this text:

<para listid= 1" level="1">text 1</para>
<para listid="1" level="2">text 2</para>
<para>text 3</para>
<para listid="1" level="1">text 4</para>
<para listid="1" level="1">text 5</para>
<para listid="1" level="1">text 6</para>
<para listid="1" level="2">text 7</para>
<para listid="1" level="1">text 8</para>
<para> text 9 </para>
<para listid="2" level="1">text 10</para>

I want to transform this into:

<list id="1" level="1">
	<para>text 1</para>
		<list id="1" level="2">
			<para>text 2</para>
			<para> text 3</para>
	<para>text 4 </para>
	<para>text 5 </para>
	<para>text 6 </para>
		<list id="1" level ="2">
			<para> text 7</para>
	<para> text 8</para>
	<para> text 9 </para>

I am not looking for a detailed, specific answer to this problem. I am
writing a script to transfrom RTF to XML, and I am trying to force RTF
into lists (such as <list> </list>). The problem is that RTF might
start a list at the beginning of a document and might run the whole
list through the document, running it over a table and other

For example, the creator of an RTF document would start a
list number on page one in the middle of a table, and then use the
"skip" feature for maybe 5 more pages. In the meantime the table would
have stopped. No mumbers would appear on these five pages, and then
the uses would start the numbering again on page 5. This forces me to
have to break the list before the table ends in order to avoid
overlapping tags.

The result is that some of the list is between <list> </list>, and
others is not.

Orignially I had planned to keep things this way. After all, it is
poor practice to abuse numbering in this way. (The headings in Word
allow for the logical division of a document--not lists).

But now I am wondering if I shouldn't try to force the list between
the <list> </list>. Rather, I should let the user of my script use
xslt to create <list> if s/he chooses.

Just to be clear, as the script is written now, it does a pretty good
job with lists. Only when the RTF does crazy things with lists does
the output turn out a little inconsistent, though still well-formed.

So what do you think--am I adding functionality to my script by
forcing things between <list> </list>, or should I let the user decide
what to do with RTF's numbering scheme? 

One last thought: the script becomes much easier if the user decides
what to do with the lists!

Sorry for the lenght of the email


*Paul Tremblay         *

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

Current Thread