[xsl] need help explaining one data structure over another

Subject: [xsl] need help explaining one data structure over another
From: "Matthew L. Avizinis" <mla@xxxxxxxxx>
Date: Fri, 2 Aug 2002 20:08:07 -0400
Hello all,
  I know that this is not really a question intrinsically related to XSLT,
but it seems like all the best minds frequent this list and also I am
subscribed to this list and not others, so here goes.

I have an index for a book.  I daresay all of you are familiar with them and
how they look and are structured.
For example,
  Aviation
     Fuel...............38, 55
     Weather.............. 183
        Services.......... 199

is a snippet of an index we have.  Some index entries may have children,
others not.

Two camps have set themselves up here for how the data should be structured
in XML with potential differences resulting in how it will be processed by
XSLT (and the supposed complexity of code).  I am not going to say which
side I am on here but I am hoping someone who is very eloquent and logical
here will be able to explain why one system would  have more advantages than
the other.
In neither system are item's necessarily pre-alphabetized.  In fact, they
likely won't be presorted at all, and certainly will have to be sort()[ed]
to make a useful index in say pdf or print formats.

system 1)
<index>
   <item></item>
   <item></item>
   <item>
     <item></item>
     <item></item>
   </item>
   <item>
     <item>
         <item></item>
     </item>
     <item></item>
   </item>
</index>

or system 2)
  <index>
    <indexdiv>  <!-- for instance, all "A's"  -->
     <indexentry>
        <primary>
           <secondary></secondary>
           <secondary>
               <tertiary></tertiary>
           </secondary>
        </primary>
     </indexentry>
    </indexdiv>
    <indexdiv>  <!-- for instance, all "B's"  -->
     <indexentry>
         etc.
     </indexentry>
    <indexdiv>
   </index>

Opponent of system 2 says that the _only_ benefit is that it is more human
readable.  Additionally, says that processing with XSLT will be more
complicated than system 1 for virtually any purpose.  Proponent of system 1
indicates that it is easier to add a fourth level to the tree without any
change to XSLT templates that may be needed to transform it.

Help me out guru's an please give me (everyone here seems to behave truly
altruisticly, hence, yes I say "give me") a good argument for why system 2
is advantageous over system 1.  (Ok, I guess I _am_ going to tell you which
side I'm on!)  I'm not really expert enough to be _really eloquent_ on
matters of XML theory so it's likely that I have just not explained it well
enough to convince the opposition of my reasoning.  One argument I have
given is that naming the items and divisions gives the data more intrinsic
meaning (to humans)-- I hope that at least that assertion is true.  I also
say that manipulating the data would be more easily accomplished with system
2 -- that the XSLT code would be no more complicated than with #1 and would,
in fact, be somewhat simpler.


If someone can defend my assertion that #2 is better than #1 , then I will
be very elated and have much gratitude.  If not, I still think system 2 at
least looks nicer.

Any takers?  I will be looking forward to reading some thought provocative
replies.

thanks much,
   Matthew L. Avizinis <mailto:mla@xxxxxxxxx>
Gleim Publications, Inc.
   4201 NW 95th Blvd.
 Gainesville, FL 32606
(352)-375-0772
      www.gleim.com <http://www.gleim.com>


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


Current Thread