[xsl] Nested List

Subject: [xsl] Nested List
From: siarom egrub <egrubs@xxxxxxxxx>
Date: Mon, 8 Jan 2007 15:28:52 -0800 (PST)
Hi all,

I am trying to get a nested list to display correctly.
I came up with two different ideas, however, neither
work correctly. The snippet for the simpler idea is
below with explanations. In the other idea I was using
for-each loops in the ordered list template.

Could someone please tell me what I am doing wrong
here?

Thanks in advance for your help!!

Regards,
S. Egrub

<!--EXPECTED OUTPUT-->
  1. The following... 
  2. Interference ...follows.
      A. Prepare ...
      B. Combine ...
If ...follows.
      A. Prepare a ...
      B. Combine ...
      C. Centrifuge...
  3. Phosphorous... 
  
<!--CURRENT OUPPUT-->  
  A. The following... 
  B. Interference ...follows.
      1. Prepare ...
      2. Combine ...
If ...follows.
      1. Prepare a ...
      2. Combine ...
      3. Centrifuge...
  C. Phosphorous... 

     
<!-- XML -->

<orderedlist>
    <--THIS LIST ITEM SHOULD BE NUMBER 1.-->
    <listitem><para>The following... </para>
    </listitem>
    <--NUMBER 2.-->
    <listitem><para>Interference
...follows.</para></listitem>
    <orderedlist>
    <--THIS LIST ITEM SHOULD BE LETTER A.(start of new
ordered list)-->
       <listitem><para>Prepare ...</para></listitem>
    <--LETTER B.-->
       <listitem><para>Combine ...</para></listitem>
    </orderedlist> 
    <para>If ...follows.</para>
    <orderedlist>
    <--THIS LIST ITEM SHOULD BE LETTER A.(start of new
ordered list)-->
      <listitem><para>Prepare a ...</para></listitem>
    <--LETTER B.-->      
      <listitem><para>Combine ...</para></listitem>
    <--LETTER C.-->      
      <listitem><para>Centrifuge...</para></listitem>
    </orderedlist>
<--NUMBER 3-->    
   <listitem><para>Phosphorous...</para></listitem>
 </orderedlist>
 
<!-- XSL SNIPPET --> 
 <!--======+Ordered list Template (numbered
list)+======-->
<xsl:template match="orderedlist">
  <fo:block>
    <fo:list-block
provisional-distance-between-starts="4mm"
font-size="8pt" text-align="justify">
 	<xsl:apply-templates/>
    </fo:list-block>
  </fo:block>
</xsl:template>
 	
 	
<!--======+List item Template (items within ordered
list)+======-->
<xsl:template match="listitem">
   <fo:list-item start-indent=".2mm">
      <fo:list-item-label>
 	 <xsl:choose>
 	   <xsl:when test="parent::orderedlist/orderedlist">
              <xsl:number format="A." count="listitem"
from="orderedlist"/>
 	   </xsl:when>
 	   <xsl:otherwise>
 	      <xsl:number format="1."/>
 	   </xsl:otherwise>
 	 </xsl:choose>
      </fo:list-item-label>
      <fo:list-item-body start-indent="1.5em"
line-height=".01pt">
 	  <xsl:apply-templates/>
      </fo:list-item-body>
   </fo:list-item>
</xsl:template>

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Current Thread