2012-12-23 46 views
0

我有一个XSLT样式表输出XSL-FO,它用于生成PDF文件。我正在返回本周的预订,并且希望在按工作日分组的PDF文件中打印预订。一切工作正常,除了预订所属的工作日。.fo创建PDF文件不如预期

为了说明我的问题,我已经作出了生成的PDF文件的截图:

WeeklyBPlan

正如你可以在图片中看到,前三预订属于25.Dezember.2012。如果我将xsl:for-each放在我发布的代码中,那么每个预订都会显示工作日。

如果我把xsl:for-each放在表体中,所有的预订,无论预订是属于26.dezember还是27.dezember,都分配到25.dezember。我不知道我做错了什么。如何正确打印预订的平日?

<xsl:template match="/"> 

    <fo:root> 

     <!-- defines the layout master --> 
     <fo:layout-master-set> 
      <fo:simple-page-master master-name="first" 
            page-height="29.7cm" 
            page-width="21cm" 
            margin-top="1cm" 
            margin-bottom="2cm" 
            margin-left="2cm" 
            margin-right="2cm"> 
       <fo:region-body margin-top="3cm" margin-bottom="1.5cm"/> 

       <fo:region-before region-name="kopf" extent="3cm"/> 
       <fo:region-after region-name="fuss" extent="1.5cm"/> 
      </fo:simple-page-master> 

      <fo:simple-page-master master-name="quer" 
        page-width="29.7cm" 
        page-height="21cm" 
        margin-top="1cm" 
        margin-bottom="2cm" 
        margin-left="2cm" 
        margin-right="2cm"> 
       <fo:region-body margin-top="1cm" margin-bottom="1.5cm" /> 

       <fo:region-before region-name="kopf" extent="1cm"/> 
       <fo:region-after region-name="fuss" extent="0.5cm"/> 

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



     <!-- starts actual layout --> 
     <fo:page-sequence master-reference="quer"> 

      <fo:static-content flow-name="kopf"> 
       <fo:block font-weight="bold" text-align="center" font-family="Arial" font-size="18pt"> 
        <xsl:text>Test</xsl:text> 
       </fo:block> 

      </fo:static-content> 

      <fo:static-content flow-name="fuss"> 
       <fo:block border-bottom-width="thin" border-bottom-style="solid" 
       border-bottom-color="black" font-weight="bold" text-align="right" font-family="Arial" font-size="9pt"> 
        erstellt am: 
        <xsl:value-of select="lfsExtension:FormatDateTime(.//Erstellt, 'dd.MM.yy HH:mm')"/> 
        <xsl:text> Seite: </xsl:text><fo:page-number/>/<fo:page-number-citation ref-id="lastBlock"/> 
       </fo:block> 
      </fo:static-content> 


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

       <!--this defines a title level 1 --> 

       <xsl:for-each select=".//WeeklyBPlan" > 

        <fo:block 


          line-height="24pt" 
          space-after.optimum="15pt" 
          padding-top="3pt"> 
         <xsl:value-of select=".//WEEKDAY" /> 
        </fo:block> 


       <!-- table start --> 
       <fo:table table-layout="fixed" border="solid" border-collapse="collapse" border-width="0.5pt"> 
        <fo:table-column column-width="25mm"/> 
        <fo:table-column column-width="12mm"/> 
        <fo:table-column column-width="20mm"/> 
           <fo:table-column column-width="50mm"/> 
        <fo:table-column column-width="20mm"/> 
        <fo:table-column column-width="25mm"/> 
           <fo:table-column column-width="10mm"/> 
        <fo:table-column column-width="30mm"/> 
        <fo:table-column column-width="35mm"/> 
        <fo:table-column column-width="35mm"/> 
        <fo:table-header> 
         <fo:table-row> 
          <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Raum</fo:block> 
          </fo:table-cell> 
          <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Zeit</fo:block> 
          </fo:table-cell> 
          <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Abteilung</fo:block> 
          </fo:table-cell> 
              <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Thema</fo:block> 
          </fo:table-cell> 
              <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Mieter</fo:block> 
          </fo:table-cell> 
              <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Tel.-Nr</fo:block> 
          </fo:table-cell> 
              <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">PAnz</fo:block> 
          </fo:table-cell> 
          <fo:table-cell> 
          <fo:block background-color="grey" 
         color="white" text-align="center">Bestuhlung</fo:block> 
          </fo:table-cell> 
              <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Bemerkung</fo:block> 
          </fo:table-cell> 
              <fo:table-cell> 
           <fo:block background-color="grey" 
         color="white" text-align="center">Ausstattung</fo:block> 
          </fo:table-cell> 
          </fo:table-row> 
         <fo:table-row> 
         </fo:table-row> 
        </fo:table-header> 
        <fo:table-body> 

          <fo:table-row> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid" padding-right="6pt" padding-left="6pt" > 
            <fo:block font-family="Arial" font-size="9pt" padding="2pt"> 
             <xsl:value-of select=".//Raum" /> 
            </fo:block> 
           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid"> 
            <fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center"> 
             <xsl:value-of select=".//Zeit" /> 
            </fo:block> 
           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid"> 
            <fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center"> 
             <xsl:value-of select=".//Abteilung" /> 
            </fo:block> 
           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid" padding-left="6pt" padding-right="6pt"> 

             <fo:block font-family="Arial" font-size="9pt" padding="2pt" wrap-option="no-wrap" > 
             <xsl:value-of select=".//Thema" /> 
             </fo:block> 

           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid"> 
           <fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center"> 
            <xsl:value-of select=".//Mieter" /> 
           </fo:block> 
           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid"> 

           <fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center"> 
            <xsl:value-of select=".//Mieter_Tel" /> 
           </fo:block> 

           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid"> 
           <fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center"> 
            <xsl:value-of select=".//Personen" /> 
           </fo:block> 
           </fo:table-cell> 
           <fo:table-cell border-right-width="0.5pt" border-right-style="solid" border-bottom-width="0.5pt" border-bottom-style="solid"> 
           <fo:block font-family="Arial" font-size="9pt" padding="2pt" text-align="center"> 
            <xsl:value-of select=".//Bestuhlung" /> 
           </fo:block> 
           </fo:table-cell> 
           <fo:table-cell padding-left="8pt" border-right-style="solid" border-bottom-width="0.5pt" border-right-width="0.5pt" border-bottom-style="solid" > 
           <fo:block font-family="Arial" font-size="9pt" padding="2pt"> 
            <xsl:value-of select=".//Bemerkung" /> 
           </fo:block> 
           </fo:table-cell> 
           <fo:table-cell padding-left="6pt" padding-right="6pt" border-bottom-width="0.5pt" border-bottom-style="solid"> 
           <fo:block font-family="Arial" font-size="9pt" padding="2pt"> 
            <xsl:value-of select=".//Ausstattung" /> 
           </fo:block> 
           </fo:table-cell> 
           </fo:table-row> 


        </fo:table-body> 
        </fo:table> 
        <!-- table end --> 


       </xsl:for-each> 


       <fo:block id="lastBlock"/> 
      </fo:flow> 




     </fo:page-sequence> 

    </fo:root> 

</xsl:template> 

回答

0

使用,各组进行分组按日期

<xsl:for-each-group select=".//WeeklyBPlan" group-by="/WEEKDAY"> 
<fo:block line-height="24pt" space-after.optimum="15pt" 
         padding-top="3pt"> 
        <xsl:value-of select="current-grouping-key()" /> 
       </fo:block> 
    //table header here 
    <xsl:for-each select="current-group()"> 
     // populate table row 
    </xsl:for-each> 
</xsl:for-each-group>