<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
version="1.0">
<xsl:import href= "tabelle_fo_pdf_kopffusszeile.xsl" />
<xsl:import href= "pageComponents_html.xsl" />
<!-- In diesem Stylesheet können Sie individuelle templates unterbringen,
die in ihrer Präzedenz das normale Stylesheet
pageComponents_html.xsl überragt. -->
<xsl:import href= "pageComponents_html_final.xsl" />
<!-- falls die folgende Datei mit individuellen Kopf/Fußzeilen existiert,
wird sie vom Servlet mit der aktuellen Mandanten-ID eingebunden-->
<!-- <xsl:import href="../custom/MANDANTENID/custom_pdf.xsl"/> -->
<xsl:import href= "resultset_html.xsl" />
<xsl:decimal-format name= "German" grouping-separator= "." NaN= "" zero-digit = "0" decimal-separator= "," />
<!-- Wenn Sie ein eigenes PDF - Stylesheet erstellen, sollten Sie die u. aufgeführte Routine zur
Berechnung der Spaltenbreite übernehmen
Wenn Sie nur das Seitenlayout ändern wollen, z.B. auf A4, dann reicht es, hier die Variablen seitenbreite_mm,
die druckbreite_mm und das Attribut page-height anzupassen.
-->
<xsl:variable name= "seitenbreite_mm" > 297</xsl:variable>
<!-- Die Breite der Tabelle in mm bei A4 Querformat: -->
<xsl:variable name= "druckbreite_mm" > 267</xsl:variable>
<!-- Wenn keine Spaltenbreite definiert ist, wird 12 (Einheit Applet - Breite) verwendet. -->
<xsl:variable name= "std_spaltenbreite" > 12</xsl:variable>
<xsl:variable name= "font_family" > Liberation Sans</xsl:variable>
<xsl:variable name= "font" > 8pt Liberation Sans</xsl:variable>
<xsl:variable name= "border_width" > 0.3mm</xsl:variable>
<xsl:variable name= "font_size_normal" >
<xsl:choose >
<xsl:when test= "/ergebnisse/ergebnis/felder/feld[@varname='font size']/value!=''" > <xsl:value-of select= "/ergebnisse/ergebnis/felder/feld[@varname='font size']/value" /> pt</xsl:when>
<xsl:when test= "/ergebnisse/ergebnis[@ordnr='0']/ergebniselement[@ordnr='0']/sqlerg/row[@no='0']/col[f_name='hidden_pdf_fontsize']/wert!=''" > <xsl:value-of select= "/ergebnisse/ergebnis[@ordnr='0']/ergebniselement[@ordnr='0']/sqlerg/row[@no='0']/col[f_name='hidden_pdf_fontsize']/wert" /> pt</xsl:when>
<xsl:otherwise > 8pt</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:template match= "/" >
<xsl:call-template name= "pdfpages" />
</xsl:template>
<xsl:template name= "pdfpages" >
<fo:root xmlns:fo= "http://www.w3.org/1999/XSL/Format" >
<!-- start allg -->
<fo:layout-master-set >
<fo:simple-page-master master-name= "first"
page-height="210mm" page-width="{concat($seitenbreite_mm,'mm')}"
margin-top="14mm" margin-bottom="16mm"
margin-left="16mm" margin-right="16mm">
<fo:region-body
margin-top="13mm" margin-bottom="7mm"
margin-left="0mm" margin-right="0mm"
/>
<xsl:call-template name= "first_page_header_height" />
<xsl:call-template name= "first_page_footer_height" />
</fo:simple-page-master>
<fo:simple-page-master master-name= "rest"
page-height="210mm" page-width="{concat($seitenbreite_mm,'mm')}"
margin-top="14mm" margin-bottom="16mm"
margin-left="16mm" margin-right="16mm">
<fo:region-body
margin-top="14mm" margin-bottom="7mm"
margin-left="0mm" margin-right="0mm"
/>
<xsl:call-template name= "rest_header_height" />
<xsl:call-template name= "rest-region-after-height" />
</fo:simple-page-master>
<fo:page-sequence-master master-name= "sequence" >
<fo:repeatable-page-master-alternatives >
<fo:conditional-page-master-reference master-reference= "first" page-position= "first" />
<fo:conditional-page-master-reference master-reference= "rest" page-position= "rest" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<!-- end allg -->
<xsl:call-template name= "pdfpage" />
<!-- end Seite -->
</fo:root>
</xsl:template>
<!-- Header/Footerdefinitionen verlagert nach tabelle_fo_pdf_kopffusszeile.xsl überlagern möglich zu machen -->
<xsl:template name= "pdfpage" >
<fo:page-sequence master-name= "sequence" master-reference= "sequence" >
<fo:static-content flow-name= "first-region-before" > <xsl:call-template name= "first_page_header" /> </fo:static-content>
<fo:static-content flow-name= "first-region-after" > <xsl:call-template name= "first_page_footer" /> </fo:static-content>
<fo:static-content flow-name= "rest-region-before" > <xsl:call-template name= "rest_page_header" /> </fo:static-content>
<fo:static-content flow-name= "rest-region-after" > <xsl:call-template name= "rest_page_footer" /> </fo:static-content>
<fo:flow flow-name= "xsl-region-body" font-family= "{$font_family}" >
<!-- start Titel -->
<xsl:if test= "/ergebnisse/makro/@id !=''" >
<fo:block font-family= "{$font_family}" line-height= "16pt" font-size= "16pt" font-weight= "bold" padding-bottom= "14pt" >
<xsl:value-of select= "/ergebnisse/makro/name" />
</fo:block>
</xsl:if>
<!-- end TItel -->
<!-- start Tabelle -->
<xsl:for-each select= "ergebnisse/ergebnis/ergebniselement" >
<xsl:variable name= "ergebniselement_ordnr" > <xsl:value-of select= "@ordnr" /> </xsl:variable>
<xsl:choose >
<xsl:when test= "@typ='image'" >
<!-- klappt noch nciht<img>
<xsl:attribute name= "src" > <xsl:value-of select= "@url" /> </xsl:attribute>
</img>
<hr /> -->
<xsl:text >
</xsl:text>
</xsl:when>
<xsl:when test= "@typ='tabelle'" >
<xsl:if test= "errmsg !=''" >
<fo:block font-family= "{$font_family}" line-height= "{$font_size_normal}" font-size= "{$font_size_normal}" > <!-- -->
<xsl:copy-of select= "errmsg" />
</fo:block>
</xsl:if>
<xsl:call-template name= "pdfergebnis" >
<xsl:with-param name= "ergebniselement_ordnr" select= "$ergebniselement_ordnr" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise >
<xsl:text > Nicht unterstützter Ergebnistyp </xsl:text> <xsl:value-of select= "@type" />
</xsl:otherwise>
</xsl:choose>
<!-- end Tabelle -->
<xsl:call-template name= "datensatzzaehler" />
</xsl:for-each>
<!-- end Tabelle -->
<xsl:call-template name= "pdfaftertable" />
<!-- Ende des Dokuments zur Ermitttlung der maximalen Seitenzahl zu Speicherintensiv -->
<fo:block id= "endofdoc" />
</fo:flow>
</fo:page-sequence>
</xsl:template>
<xsl:template name= "pdfaftertable" />
<xsl:template name= "pdftable" >
<xsl:param name= "width" />
<xsl:variable name= "tablewidth" >
<xsl:choose >
<xsl:when test= "$width!=''" > <xsl:value-of select= "$width" /> </xsl:when>
<xsl:otherwise > <xsl:text > auto</xsl:text> </xsl:otherwise>
</xsl:choose>
</xsl:variable>
<fo:table border-collapse= "collapse" table-layout= "auto" width= "{$tablewidth}" >
<!-- bei Makros nach jeder Tabelle einen Seitenumbruch -->
<xsl:if test= "/ergebnisse/@isMakro='true'" >
<xsl:attribute name= "break-after" > <xsl:text > page</xsl:text> </xsl:attribute>
</xsl:if>
<xsl:text >
</xsl:text>
<xsl:call-template name= "pdfcolumnwidths" />
<xsl:call-template name= "pdftableheaders" />
<!-- start body -->
<xsl:choose >
<xsl:when test= "count(sqlerg/row) = 0" > <!-- saxon verlangt hier mind. eine Zeile -->
<fo:table-body > <fo:table-row > <fo:table-cell > <fo:block > </fo:block> </fo:table-cell> </fo:table-row> </fo:table-body>
</xsl:when>
<xsl:otherwise >
<xsl:call-template name= "pdftablebody" />
</xsl:otherwise>
</xsl:choose>
</fo:table>
</xsl:template>
<xsl:template name= "pdfergebnis" >
<xsl:param name= "ergebniselement_ordnr" select= "0" />
<fo:table margin-top= "0px" >
<fo:table-body >
<fo:table-row >
<fo:table-cell >
<xsl:call-template name= "pdftabletitle" />
<fo:block margin-bottom= "5px" > </fo:block>
<xsl:call-template name= "legende_fo" >
<xsl:with-param name= "ergebniselement_ordnr" select= "$ergebniselement_ordnr" />
</xsl:call-template>
<fo:block margin-bottom= "0px" > </fo:block>
<xsl:if test= "/ergebnisse/ergebnis/hinweis != ''" >
<fo:block margin-bottom= "5px" font-family= "{$font_family}" line-height= "{$font_size_normal}" font-size= "{$font_size_normal}" >
<xsl:text > Hinweis: </xsl:text> <xsl:value-of select= "/ergebnisse/ergebnis/hinweis" />
</fo:block>
</xsl:if>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<!-- <xsl:call - template name="pdftabletitle"/>
<fo:block margin-bottom= "10px" > </fo:block>
<xsl:call-template name= "legende_fo" /> -->
<xsl:call-template name= "pdftable" />
</xsl:template>
<xsl:template name= "pdftablebody" >
<fo:table-body >
<xsl:variable name= "erglevelmax" >
<xsl:if test= "count(sqlerg/row/col [ f_name = 'ebene' ]) > 0" >
<xsl:choose >
<xsl:when test= "count(sqlerg/row/col [ f_name = 'ebene' ] /wert [ . = '4']) > 0" >
<xsl:text > 4</xsl:text>
</xsl:when>
<xsl:when test= "count(sqlerg/row/col [ f_name = 'ebene' ] /wert [ . = '3']) > 0" >
<xsl:text > 3</xsl:text>
</xsl:when>
<xsl:when test= "count(sqlerg/row/col [ f_name = 'ebene' ] /wert [ . = '2']) > 0" >
<xsl:text > 2</xsl:text>
</xsl:when>
<xsl:when test= "count(sqlerg/row/col [ f_name = 'ebene' ] /wert [ . = '1']) > 0" >
<xsl:text > 1</xsl:text>
</xsl:when>
<xsl:otherwise >
<xsl:text > 5</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:variable>
<xsl:call-template name= "pdftablerows" >
<xsl:with-param name= "erglevelmax" > $erglevelmax</xsl:with-param>
</xsl:call-template>
</fo:table-body>
</xsl:template>
<xsl:template name= "pdftablerows" >
<xsl:param name= "erglevelmax" />
<xsl:for-each select= "sqlerg/row" >
<xsl:call-template name= "pdfsinglerow" > <xsl:with-param name= "erglevelmax" > $erglevelmax</xsl:with-param> </xsl:call-template>
</xsl:for-each>
</xsl:template>
<xsl:template name= "pdfsinglerow" >
<xsl:param name= "erglevelmax" />
<fo:table-row border-style= "solid" >
<xsl:choose >
<xsl:when test= "col/f_name = 'ebene'" >
<!-- DQ 14.12.07 In Zukunft noch erglevelmax auswerten when$erglevelmax = 5 and -->
<xsl:choose >
<xsl:when test= "6-$erglevelmax+col[ f_name = 'ebene' ] /wert='1'" >
<xsl:attribute name= "border-width" > <xsl:value-of select= "$border_width" /> </xsl:attribute>
<xsl:attribute name= "background-color" > <xsl:text > #cccccc</xsl:text> </xsl:attribute>
</xsl:when>
<xsl:when test= "6-$erglevelmax+col[ f_name = 'ebene' ] /wert='2'" >
<xsl:attribute name= "border-width" > <xsl:value-of select= "$border_width" /> </xsl:attribute>
</xsl:when>
<xsl:when test= "6-$erglevelmax+col[ f_name = 'ebene' ] /wert='3'" >
<xsl:attribute name= "border-width" > <xsl:value-of select= "$border_width" /> </xsl:attribute>
<xsl:attribute name= "background-color" > <xsl:text > #cccccc</xsl:text> </xsl:attribute>
</xsl:when>
<xsl:when test= "6-$erglevelmax+col[ f_name = 'ebene' ] /wert='4'" >
<xsl:attribute name= "border-width" > <xsl:value-of select= "$border_width" /> </xsl:attribute>
<xsl:attribute name= "background-color" > <xsl:text > #e6e6e6</xsl:text> </xsl:attribute>
</xsl:when>
<xsl:when test= "6-$erglevelmax+ col[ f_name = 'ebene' ] /wert='5'" >
<xsl:attribute name= "background-color" > <xsl:text > #e6e6e6</xsl:text> </xsl:attribute>
</xsl:when>
<xsl:otherwise >
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test= "@issumme='true'" >
<xsl:attribute name= "border-width" > <xsl:value-of select= "$border_width" /> </xsl:attribute>
<xsl:attribute name= "background-color" > <xsl:text > #cccccc</xsl:text> </xsl:attribute>
</xsl:when>
<xsl:otherwise >
<xsl:choose >
<xsl:when test= "@no mod 2 = 1" >
<xsl:attribute name= "background-color" > <xsl:text > #EFEFEF</xsl:text> </xsl:attribute>
</xsl:when>
<xsl:when test= "@no mod 2 = 0" >
<xsl:attribute name= "background-color" > <xsl:text > #FFFFFF</xsl:text> </xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text >
</xsl:text>
<xsl:for-each select= "col[starts-with(f_name,'hidden')=false and starts-with(f_name,'next') = false ]" >
<xsl:call-template name= "pdftablecell" /> <xsl:text >
</xsl:text>
</xsl:for-each>
</fo:table-row> <xsl:text >
</xsl:text>
</xsl:template>
<xsl:template name= "pdfcolumnwidths" >
<xsl:variable name= "gesamtbreite_str" >
<xsl:text > 0</xsl:text>
<!-- MB 4/2010 keine Link oder versteckten SPalten -->
<xsl:for-each select= "sqlerg/headers/header[starts-with(f_name,'hidden')=false and starts-with(f_name,'next') = false ]" >
<xsl:text > +</xsl:text> <xsl:value-of select= "@width" />
</xsl:for-each>
</xsl:variable>
<!-- MB 10.6.09 keine Linkspalten -->
<xsl:variable name= "defbreite" > <xsl:value-of select= "sum(sqlerg/headers/header[ @width > 0 and starts-with(f_name,'hidden')=false and starts-with(f_name,'next') = false ]/@width )" /> </xsl:variable>
<xsl:variable name= "ndefbreite" > <xsl:value-of select= "count(sqlerg/headers/header[ @width = '' and starts-with(f_name,'hidden')=false and starts-with(f_name,'next') = false])" /> </xsl:variable>
<xsl:variable name= "gesamtbreite" > <xsl:value-of select= "$defbreite+($ndefbreite* $std_spaltenbreite)" /> </xsl:variable>
<xsl:for-each select= "sqlerg/headers/header[starts-with(f_name,'hidden')=false and starts-with(f_name,'next') = false ]" >
<xsl:text >
</xsl:text>
<xsl:comment > <xsl:value-of select= "$defbreite" /> </xsl:comment>
<fo:table-column >
<xsl:attribute name= "column-width" >
<xsl:choose >
<!-- Wenn Tabelle zu breit ist
<xsl:when test= "$defbreite > 320" >
<xsl:variable name= "spbreite" > <xsl:value-of select= "@width * (12 div 20)" />
</xsl:variable>
<xsl:value-of select= "concat($spbreite,'em')" />
</xsl:when>
-->
<xsl:when test= "@width != ''" >
<!-- Im Applet ist die Breite definiert als Multiplikator von einem Schriftzeichen (em).
In FOP ist 1em=ca.20pt, d.h. um zur Schriftgröße 12pt zu kommen, wird Faktor benutzt.-->
<!-- <xsl:variable name="spbreite"><xsl:value - of select="@width * (12 div 20)" />
</xsl:variable>
<xsl:value-of select= "concat($spbreite,'em')" />
-->
<xsl:variable name= "spbreite" > <xsl:value-of select= "$druckbreite_mm*(@width div $gesamtbreite)" />
</xsl:variable>
<xsl:choose >
<xsl:when test= "$spbreite > 2" >
<xsl:value-of select= "concat($spbreite,'mm')" />
</xsl:when>
<xsl:otherwise >
<xsl:text > auto</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "$druckbreite_mm*($std_spaltenbreite div $gesamtbreite)" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<!--
<xsl:attribute name= "column-number" >
<xsl:value-of select= "(@id+1)" />
</xsl:attribute> -->
</fo:table-column>
</xsl:for-each>
</xsl:template>
<xsl:template name= "pdftabletitle" >
<fo:block font-family= "{$font_family}" line-height= "14pt" font-size= "14pt" font-weight= "bold" color= "rgb(0,0,0)" space-after= "2mm" >
<xsl:value-of select= "/ergebnisse/ergebnis/maskenname" /> </fo:block>
<fo:block font-family= "{$font_family}" line-height= "{$font_size_normal}" font-size= "{$font_size_normal}" >
Datensatz vom <xsl:value-of select= "/ergebnisse/ergebnis/stand" /> </fo:block>
</xsl:template>
<xsl:template name= "pdflogo" >
<fo:block font-family= "{$font_family}" line-height= "{$font_size_normal}" font-size= "{$font_size_normal}" font-weight= "bolder" color= "rgb(0,0,0)" margin-bottom= "10mm" text-align= "end" space-after= "5mm" >
<fo:external-graphic >
<!-- im Servlet steht:
foUserAgent.setBaseURL("file:///"+ getServletConfig().getServletContext().getRealPath("/") ); -->
<xsl:attribute name= "src" > <xsl:text > servlet/</xsl:text> </xsl:attribute>
</fo:external-graphic> </fo:block>
</xsl:template>
<xsl:template name= "pdftableheaders" >
<fo:table-header >
<!-- Spaltenüberschriften: zunächst wird geprüft, ob Spaltenüberschriften verknüpft werden sollen -->
<xsl:variable name= "spanned_cols" >
<xsl:for-each select= "sqlerg/headers/header" >
<xsl:if test= "contains(wert,'\000')" >
<xsl:text > true</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:choose >
<xsl:when test= "sqlerg/headers/@hasAggregationHeaders='true'" >
<xsl:for-each select= "sqlerg/aggregationHeaders" >
<xsl:for-each select= "tr" >
<fo:table-row >
<xsl:for-each select= "th [ @isHidden='false' and starts-with(@f_name,'hidden') = false and starts-with(@f_name,'next') = false] " >
<fo:table-cell padding= "1mm" border-width= "{$border_width}" keep-together.within-column= "always" border-style= "solid" >
<xsl:if test= "@rowspan != ''" >
<xsl:attribute name= "number-rows-spanned" > <xsl:value-of select= "@rowspan" /> </xsl:attribute>
</xsl:if>
<xsl:if test= "@colspan != ''" >
<xsl:attribute name= "number-columns-spanned" > <xsl:value-of select= "@colspan" /> </xsl:attribute>
</xsl:if>
<!-- language =en wg. hyphenation -->
<fo:block text-align= "center" font-size= "{$font_size_normal}" font-weight= "bold" language= "en" hyphenate= "true" > <!-- hyphenation raus, fop kommt sonst in Endlosschleife -->
<xsl:call-template name= "removeBackslashN" >
<xsl:with-param name= "derwert" > <xsl:value-of select= "." /> </xsl:with-param>
<xsl:with-param name= "format" > <xsl:value-of select= "'html'" /> </xsl:with-param>
</xsl:call-template>
</fo:block>
</fo:table-cell> <xsl:text >
</xsl:text>
</xsl:for-each>
</fo:table-row> <xsl:text >
</xsl:text>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise >
<!-- Normale headers -->
<fo:table-row >
<xsl:for-each select= "sqlerg/headers/header[starts-with(f_name,'hidden')=false and starts-with(f_name,'next') = false ]" >
<xsl:call-template name= "foheader" >
<xsl:with-param name= "derwert" select= "wert" />
</xsl:call-template>
<xsl:text >
</xsl:text>
</xsl:for-each>
</fo:table-row>
</xsl:otherwise>
</xsl:choose>
</fo:table-header>
</xsl:template>
<xsl:template name= "pdftablecell" >
<fo:table-cell keep-together.within-line= "always" hyphenate= "true" xml:lang= "de" border-width= "{$border_width}" border-style= "solid" padding= "1mm" >
<fo:block font-size= "{$font_size_normal}" font-family= "{$font_family}"
line-height="{$font_size_normal}" language="en" hyphenate="true">
<xsl:variable name= "checkname" > <xsl:value-of select= "concat('hidden',f_name,'dp')" /> </xsl:variable>
<xsl:choose >
<xsl:when test= "@typ='2' or @typ='8' or @typ='3'" > <!-- DecimalFormat -->
<xsl:attribute name= "text-align" > end</xsl:attribute>
<xsl:choose > <!-- MB wenn es eine versteckte hidden_decimalpl gibt auswerten -->
<xsl:when test= "../col[f_name=$checkname]/wert='0'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.###','German')" />
</xsl:when>
<xsl:when test= "../col[f_name=$checkname]/wert='1'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,0','German')" />
</xsl:when>
<xsl:when test= "../col[f_name=$checkname]/wert='2'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,00','German')" />
</xsl:when>
<xsl:when test= "../col[f_name=$checkname]/wert='3'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,000','German')" />
</xsl:when>
<xsl:when test= "../col[f_name=$checkname]/wert='4'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,0000','German')" />
</xsl:when>
<xsl:when test= "../col[f_name=$checkname]/wert='5'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,00000','German')" />
</xsl:when>
<xsl:when test= "../col[f_name=$checkname]/wert='6'" >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,000000','German')" />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "format-number(wert,'###.###.###.###.##0,00','German')" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test= "@typ='4'" > <!-- Integer -->
<xsl:attribute name= "text-align" > end</xsl:attribute>
<!-- <xsl:attribute name="class">integer</xsl:attribute> -->
<!-- <xsl:value - of select="wert" /> -->
<xsl:value-of select= "format-number(wert,'###.###.###.###.###','German')" />
</xsl:when>
<xsl:otherwise >
<!-- Typ=1 ist string und wird defaultmäßig behandelt -->
<xsl:attribute name= "text-align" > start</xsl:attribute>
<xsl:choose >
<xsl:when test= "f_name='email'" >
<xsl:value-of select= "wert" />
</xsl:when>
<xsl:when test= "f_name='url'" >
<!-- <a target="_blank"><xsl:attribute name="href"><xsl:value - of select="wert" /></xsl:attribute> -->
<xsl:value-of select= "wert" /> <!-- </a> -->
</xsl:when>
<xsl:when test= "f_name='nextmask'" >
</xsl:when>
<xsl:when test= "f_name='nexttable'" >
</xsl:when>
<xsl:otherwise >
<xsl:call-template name= "insert_zero_length_chars_for_wraps2" >
<xsl:with-param name= "text" select= "wert" />
<!-- m <xsl:with - param name="max_length" select="number(10)" /> -->
</xsl:call-template>
<!-- <xsl:value - of select="wert" /> -->
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:table-cell> <xsl:text >
</xsl:text>
</xsl:template>
<!-- end template -->
<!-- start legende -->
<xsl:template name= "legende_fo" >
<xsl:param name= "ergebniselement_ordnr" select= "0" />
<fo:block font= "{$font}" font-family= "{$font_family}"
line-height="{$font_size_normal}" font-size="{$font_size_normal}"
margin-bottom="5px">
<!-- border - width="0.5mm" border - style="solid" border - color="gray" space - after="10mm" -->
<xsl:for-each select= "/ergebnisse/ergebnis[@ordnr=$ergebniselement_ordnr]/felder/feld" >
<xsl:if
test="(value !='' or sicht/@isFirstInGroup='false' or @isstandtoday='false') and @varname != 'sort' and @varname != 'maxoffset'">
<fo:inline font-weight= "bold" >
<xsl:choose >
<xsl:when
test="string-length(caption_short) > 0 and caption_short != 'null'">
<![CDATA[]]>
<xsl:value-of select= "caption_short" /> <![CDATA[]]>
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "@varname" />
</xsl:otherwise>
</xsl:choose>
</fo:inline>
<fo:inline > :  </fo:inline>
<fo:inline > <!-- font - style="italic" font - weight="bold"> -->
<![CDATA[]]>
<xsl:value-of select= "value_caption" /> <![CDATA[]]> ; 
</fo:inline>
<!-- MB 12.6.09 bei Mehrfachauswahl werden alle Auswahl benötigt in
Legende <xsl:if test= "string-length(value_caption) < 50" > <![CDATA[]]> <xsl:value-of
select="value_caption" /><![CDATA[]]> </xsl:if> <xsl:if test= "string-length(value_caption)
> 49"> <![CDATA[]]> <xsl:value-of select= "substring(value_caption,0,50)"
/>...<![CDATA[]]> </xsl:if> -->
<!-- <xsl:if test="sicht!=''"> <![CDATA[]]><xsl:text> (</xsl:text><xsl:value - of
select="sicht" /> <xsl:if test= "@stand!=''" > <xsl:text > - Stand:</xsl:text> <xsl:value-of
select="@staFZnd"/></xsl:if> <xsl:text > )</xsl:text> <![CDATA[]]> </xsl:if> -->
</xsl:if>
</xsl:for-each>
<fo:inline font-weight= "bold" >
<xsl:text > User: </xsl:text>
</fo:inline>
<xsl:value-of select= "/ergebnisse/user" />
<!-- <xsl:text>; Stand: </xsl:text><xsl:value - of select="../stand" /> -->
</fo:block>
<!-- <xsl:for - each select="/ergebnis/felder/msgs/msg"> <xsl:if test="wert
!=''"> <fo:block space-after= "10mm" font-family= "{$font_family}" line-height= "16pt"
font-size="14pt"> <xsl:value-of select= "wert" /> </fo:block> </xsl:if> </xsl:for-each> -->
</xsl:template>
<!-- end legende -->
<!-- start foheader -->
<xsl:template name= "foheader" >
<xsl:param name= "derwert" />
<fo:table-cell border-width= "{$border_width}" padding= "1mm"
border-style="solid">
<xsl:text >
</xsl:text>
<fo:block margin= "1px" font-size= "{$font_size_normal}"
font-weight="bold" language="en" hyphenate="true">
<xsl:variable name= "header1" >
<xsl:choose >
<xsl:when test= "(contains(string($derwert),'\n'))" >
<xsl:value-of select= "substring-before($derwert,'\n') " />
<xsl:text >
</xsl:text>
<xsl:value-of select= "substring-after($derwert,'\n') " />
</xsl:when>
<xsl:otherwise >
<xsl:copy-of select= "$derwert" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name= "header2" >
<xsl:choose >
<xsl:when test= "(contains(string($header1),'\n'))" >
<xsl:value-of select= "substring-before($header1,'\n') " />
<xsl:text >
</xsl:text>
<xsl:value-of select= "substring-after($header1,'\n') " />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "$header1" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose >
<xsl:when test= "(contains(string($header2),'\000'))" >
<xsl:value-of select= "substring-before($header2,'\000') " />
<xsl:text >
</xsl:text>
<xsl:value-of select= "substring-after($header2,'\000') " />
</xsl:when>
<xsl:otherwise >
<xsl:value-of select= "$header2" />
</xsl:otherwise>
</xsl:choose>
<xsl:text >
</xsl:text>
</fo:block>
</fo:table-cell>
<xsl:text >
</xsl:text>
</xsl:template>
<!-- end foheader -->
<!-- bei langen Texten in Feldern zero width char einfuegen, damit wird
wrap nach jedem Zeichen moeglich -->
<!-- http://xmlgraphics.apache.org/fop/faq.html#cells - overflow -->
<xsl:template name= "insert_zero_length_chars_for_wraps2" >
<xsl:param name= "text" select= "." />
<xsl:param name= "i" select= "1" />
<xsl:choose >
<xsl:when test= '$i>=string-length($text)' >
<xsl:value-of select= "$text" />
</xsl:when>
<xsl:otherwise >
<xsl:call-template name= "insert_zero_length_chars_for_wraps2" >
<xsl:with-param name= "text"
select="concat(substring($text,1,$i),'​ ',substring($text,$i+1,string-length($text)-$i))" />
<xsl:with-param name= "i" select= "$i+2" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- derzeit nicht genutzte alternative nur nach max_length Zeichen ein Leerzeichen
einfuegen- gut wäre whitespace noch zu kontrollieren -->
<xsl:template name= "insert_zero_length_chars_for_wraps" >
<xsl:param name= "value" />
<xsl:param name= "max_length" />
<xsl:variable name= "ret" >
<xsl:value-of select= "substring($value, 1, $max_length)" />
<xsl:if test= "string-length($value) > $max_length" >
<xsl:value-of select= "'​'" />
<xsl:call-template name= "insert_zero_length_chars_for_wraps" >
<xsl:with-param name= "value"
select="substring($value, $max_length + 1)" />
<xsl:with-param name= "max_length" select= "$max_length" />
</xsl:call-template>
</xsl:if>
</xsl:variable>
<xsl:value-of select= "$ret" />
</xsl:template>
<xsl:template name= "zero_width_space_1" >
<xsl:param name= "data" />
<xsl:param name= "counter" select= "0" />
<xsl:choose >
<xsl:when test= "$counter < string-length($data)" >
<xsl:value-of select= 'concat(substring($data,$counter,1),"​")' />
<xsl:call-template name= "zero_width_space_2" >
<xsl:with-param name= "data" select= "$data" />
<xsl:with-param name= "counter" select= "$counter+1" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise >
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name= "zero_width_space_2" >
<xsl:param name= "data" />
<xsl:param name= "counter" />
<xsl:value-of select= 'concat(substring($data,$counter,1),"​")' />
<xsl:call-template name= "zero_width_space_1" >
<xsl:with-param name= "data" select= "$data" />
<xsl:with-param name= "counter" select= "$counter+1" />
</xsl:call-template>
</xsl:template>
</xsl:stylesheet>