Re: Formatting elements

Subject: Re: Formatting elements
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Wed, 04 Oct 2000 18:37:52 +0100
Paul,

>I'll first give XSLScript notation and then will be the XSL code
>( generated, as usual ). I think this should illustrate the
>real value of terseness.

Thanks for giving us a taste of XSLScript - it's really interesting to see
it in action.  However, your solution doesn't cope 'properly' with:

<document>
 <item name='title'><text>Title field</text></item>
 <item name='bullet1'><text>some text for item 1</text></item>
 <item name='bullet2'><text>some text for item 2</text></item>
 <item name='bullet3'><text/></item>
 <item name='bullet4'><text/></item>
 <item name='bullet5'><text/></item>
 <item name='bullet6'><text/></item>
 <item name='bullet1'><text>some text for item 1</text></item>
 <item name='bullet2'><text>some text for item 2</text></item>
 <item name='bullet3'><text/></item>
 <item name='bullet4'><text/></item>
</document>

as it creates only a single bulletlist in this case whereas I think it
should create two.

I'm not trying to engage in a 'my solution is better than your solution'
argument, but I did also forget to make explicit that my solution can
handle cases where there are other items that are named with names that end
in a number.  For example:

<document>
 <item name='title'><text>Title field</text></item>
 <item name='bullet1'><text>some text for item 1</text></item>
 <item name='bullet2'><text>some text for item 2</text></item>
 <item name='bullet3'><text/></item>
 <item name='bullet4'><text/></item>
 <item name='bullet5'><text/></item>
 <item name='bullet6'><text/></item>
 <item name='num1'><text>some text for item 1</text></item>
 <item name='num2'><text>some text for item 2</text></item>
 <item name='num3'><text/></item>
 <item name='num4'><text/></item>
 <item name='menu1'><text>some text for item 1</text></item>
 <item name='menu2'><text>some text for item 2</text></item>
 <item name='menu3'><text/></item>
 <item name='menu4'><text/></item>
</document>

gives:

<document xmlns:fo="foo">
   <title>Title field</title>
   <bulletlist>
      <bullet>some text for item 1</bullet>
      <bullet>some text for item 2</bullet>
      <bullet/>
      <bullet/>
      <bullet/>
      <bullet/>
   </bulletlist>
   <numlist>
      <num>some text for item 1</num>
      <num>some text for item 2</num>
      <num/>
      <num/>
   </numlist>
   <menulist>
      <menu>some text for item 1</menu>
      <menu>some text for item 2</menu>
      <menu/>
      <menu/>
   </menulist>
</document>

Out of interest, could you give another example that deals with this as
well?  I only ask because it is relatively easy to develop a relatively
terse Muenchian solution that deals with only 'bullet' cases, and I'm not
particularly happy with the solution I gave (which was pretty ugly mainly
because of the hoops I had to jump through to account for this
generalisation), and would like to see it improved on, particularly if
XSLScript can do so.  Don't worry if you don't have time.

Cheers,

Jeni

Jeni Tennison
http://www.jenitennison.com/


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


Current Thread