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

problems with a basic list-example

Expand Messages
  • schmitz_joerg@t-online.de
    Hello, I hope someone here can help me creating a list. It should be not more than a basic list-example . This is how it should look like: 1 Dies ist
    Message 1 of 2 , Apr 2, 2001
    • 0 Attachment
      Hello,
       
      I hope someone here can help me creating a list.
      It should be not more than a basic "list-example".
       
      This is how it should look like:
       
      1  Dies ist Testzeile 1 der Liste
      2  Dies ist Testzeile 2 der Liste
      3  Dies ist Testzeile 3 der Liste
      4  Dies ist Testzeile 4 der Liste
      5  Dies ist Testzeile 5 der Liste
       
      And this is how it (the pdf-file) looks like now:
       
      1   Dies ist Testzeile 1 der Liste Dies ist Testzeile 2 der Liste Dies ist Testzeile 3 der
          Liste Dies ist Testzeile 4 der Liste Dies ist Testzeile 5 der Liste
       
       
      Not really necessary to say that I´m not very happy with that.
       

      This is the XSL-File:
       
      <?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">
          <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:template>
       
      </xsl:stylesheet>
       
       
       
       
       
      and this one the XML-File:
       
      <Test>
         <List>
            <Listelement>Dies ist Testzeile 1 der Liste</Listelement>
            <Listelement>Dies ist Testzeile 2 der Liste</Listelement>
            <Listelement>Dies ist Testzeile 3 der Liste</Listelement>
            <Listelement>Dies ist Testzeile 4 der Liste</Listelement>
            <Listelement>Dies ist Testzeile 5 der Liste</Listelement>
         </List>
      </Test>
       
       
       
      Thank you very much for your help.
      Bye
      Joerg
    • 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 2 of 2 , Apr 2, 2001
      • 0 Attachment
        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.