[xsl] XSL-FO list with sublist

Subject: [xsl] XSL-FO list with sublist
From: Lucas Gonçalves Grossi <lggrossi@xxxxxxxxxx>
Date: Wed, 12 Dec 2007 16:11:43 -0200
Hello,

I'm having problem to create a list with sublists, like:
1.
   1.1
       1.1.1
2.
   2.1.
       2.1.1

I don't need the numbers, it's just an example to ilustrate. I'm
trying to do like below, but xsl-fo don't accept <fo:list-item> inside
another <fo:list-item> without closing the first one. It generates and
error.
Can anybody help me?

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format";
                             xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>
<xsl:template match="/">
   <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
       <fo:layout-master-set>
           <fo:simple-page-master master-name="simple"
                              page-height="29.7cm"
                              page-width="21cm"
                              margin-top="1cm"
                              margin-bottom="2cm"
                              margin-left="2.5cm"
                              margin-right="2.5cm">
               <fo:region-body margin-top="3cm"/>
               <fo:region-before extent="3cm"/>
               <fo:region-after extent="1.5cm"/>
           </fo:simple-page-master>
       </fo:layout-master-set>

       <fo:page-sequence master-reference="simple">
           <fo:flow flow-name="xsl-region-body">
                   <fo:block text-align="center"
                             text-indent="5mm"
                             font-family="arial" font-size="18pt"
                             space-before="5mm" space-after="10mm">
                       <xsl:value-of select="gqmroot/@titleRoot"/>
                   </fo:block>

                   <fo:list-block>
                       <fo:list-item>
                           <fo:list-item-label>
                               <fo:block></fo:block>
                           </fo:list-item-label>
                           <fo:list-item-body>
                               <xsl:for-each select="gqmroot/goal">
                               <fo:block text-indent="5mm"
                                         font-family="arial" font-size="12pt"
                                         space-before="5mm"
space-after="5mm">
                                   <xsl:value-of select="@titleGoal"/>
                                       <fo:list-item>
                                           <fo:list-item-label>
                                               <fo:block></fo:block>
                                           </fo:list-item-label>
                                           <fo:list-item-body>
                                               <xsl:for-each
select="question">
                                               <fo:block text-indent="5mm"

font-family="arial" font-size="12pt"

space-before="5mm" space-after="5mm">

                                                   <xsl:value-of
select="@titleQuestion"/>
                                                       <fo:list-item>
                                                           <fo:list-item-labe
l>

<fo:block></fo:block>

</fo:list-item-label>
                                                           <fo:list-item-body
>

<xsl:for-each select="question">

<fo:block text-indent="5mm"

  font-family="arial" font-size="12pt"

  space-before="5mm" space-after="5mm">


<xsl:value-of select="@titleQuestion"/>

 <fo:list-item>

    <fo:list-item-label>

        <fo:block></fo:block>

    </fo:list-item-label>

    <fo:list-item-body>

        <xsl:for-each select="metric">

        <fo:block text-indent="5mm"

                  font-family="arial" font-size="12pt"

                  space-before="5mm" space-after="5mm">


                <xsl:value-of select="@titleMetric"/>

                <xsl:value-of select="unparsed-text(@ChartLink)"
disable-output-escaping="yes"/>


        </fo:block>

        </xsl:for-each>

    </fo:list-item-body>

 </fo:list-item>

                                                               </fo:block>
                                                               </xsl:for-each
>

</fo:list-item-body>
                                                       </fo:list-item>

                                               </fo:block>
                                               </xsl:for-each>
                                           </fo:list-item-body>
                                       </fo:list-item>

                               </fo:block>
                               </xsl:for-each>
                           </fo:list-item-body>
                       </fo:list-item>
                   </fo:list-block>

           </fo:flow>
       </fo:page-sequence>
   </fo:root>
</xsl:template>
</xsl:stylesheet>


Thanks a lot,
LUCAS

Current Thread