Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XSL-FO] problems with a basic list-example

Expand Messages
  • AndrewWatt2001@aol.com
    In a message dated 02/04/01 23:58:32 GMT Daylight Time, ... Joerg, Here is a working version of your XSL stylesheet. You had double-used the
    Message 1 of 2 , Apr 2, 2001
      In a message dated 02/04/01 23:58:32 GMT Daylight Time,
      schmitz_joerg@... writes:


      I hope someone here can help me creating a list.
      It should be not more than a basic "list-example".


      Joerg,

      Here is a working version of your XSL stylesheet.

      You had double-used the <fo:list-block> element - you had nested the <
      xsl:apply-templates> within it and then used it again within the template.

      Also I have added to and amended your code a little to get it working. Note
      the addition of an <xsl:for-each> element.

      I hope that helps.

      Regards

      Andrew Watt

      <?xml version="1.0"?>
      <xsl:stylesheet version="1.0"
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       xmlns:fo="http://www.w3.org/1999/XSL/Format">

       <xsl:template match="/">
         <xsl:apply-templates select="Test"/>
       </xsl:template>
       
       <xsl:template match="Test">

         <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

           <fo:layout-master-set>
             <fo:simple-page-master
              master-name="main"
              page-width="210mm"
              page-height="297mm"
              margin-top="2.5cm"
              margin-bottom="2cm"
              margin-left="2.5cm"
              margin-right="2.5cm">

               <fo:region-body margin-bottom="50pt"/>

             </fo:simple-page-master>
           </fo:layout-master-set>

           <fo:page-sequence master-name="main">

             <fo:flow flow-name="xsl-region-body">

                 <fo:list-block>
                  <xsl:apply-templates select="List"/>
                </fo:list-block>
               
             </fo:flow>

           </fo:page-sequence>

         </fo:root>

       </xsl:template>

       <xsl:template match ="List">
         <xsl:for-each select="Listelement">
           <fo:list-item>

           <fo:list-item-label><fo:block>
             <xsl:number/>
           </fo:block></fo:list-item-label>

           <fo:list-item-body><fo:block>
             <xsl:value-of select="."/>    <!--I think the mistake should be here--
      >
           </fo:block></fo:list-item-body>

        </fo:list-item>
       </xsl:for-each>
        
       </xsl:template>

      </xsl:stylesheet>
    Your message has been successfully submitted and would be delivered to recipients shortly.