Berichtsassistent
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1104 lines
46 KiB

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://jasperreports.sourceforge.net/jasperreports">
<xsl:param name="font" select="'Liberation Sans'" /><!--TODO {$font} als style-->
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template name="generateJasperReport">
<xsl:param name="isMainReport" select="'true'" />
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:param name="druckbreite" select="812" />
<xsl:param name="seitenbreite" select="842" />
<xsl:param name="seitenhoehe" select="595" />
<xsl:param name="seitenrand" select="12" />
<xsl:param name="topMargin" select="12" />
<xsl:param name="bottomMargin" select="12" />
<xsl:param name="isIgnorePagination" select="'true'" />
<xsl:param name="orientation" select="'Landscape'" />
<xsl:param name="stylesFile" select="'simple_table.jrtx'" />
<xsl:param name="font" select="'Liberation Sans'" /><!--TODO Arial als style-->
<!--Die Breite der Tabelle in pixel bei A4 Querformat:-->
<!-- Wenn keine Spaltenbreite definiert ist, wird 12 (Einheit Applet-Breite) verwendet. -->
<xsl:param name="std_spaltenbreite" select="'12'" />
<xsl:param name="std_zeilenhoehe_header" select="30" />
<xsl:param name="std_zeilenhoehe_tablerow" select="25" />
<xsl:variable name="isMacroReport" select="/ergebnisse/@isMakro" />
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="{/ergebnisse/ergebnis[@ordnr=$ergebniselementOrdnr]/maskenname}"
language="groovy"
pageWidth="{$seitenbreite}"
pageHeight="{$seitenhoehe}"
orientation="{$orientation}"
columnWidth="{$druckbreite}"
leftMargin="{$seitenrand}"
rightMargin="{$seitenrand}"
topMargin="{$topMargin}"
bottomMargin="{$bottomMargin}"
isIgnorePagination="{$isIgnorePagination}" >
<xsl:call-template name="jr_properties" />
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.band.2" value="pageFooter"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.1" value="pageHeader"/>
<property name="net.sf.jasperreports.export.xlsx.exclude.origin.band.2" value="pageFooter"/>
<!-- zum Testen-->
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="TUHH_kennz_bericht_ba"/>
<!--<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w1" value="466"/>
<property name="com.jaspersoft.studio.property.dataset.dialog.DatasetDialog.sash.w2" value="522"/>-->
<template><xsl:value-of select="concat('&quot;',$stylesFile,'&quot;')" /></template>
<xsl:call-template name="jr_styles" >
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr" />
</xsl:call-template>
<xsl:call-template name="querystring">
<xsl:with-param name="ordnr" select="$ergebniselementOrdnr" />
</xsl:call-template>
<xsl:if test="$isMainReport='true'">
<xsl:call-template name="jr_fields_report_level" />
</xsl:if>
<xsl:call-template name="jr_fields" >
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
<xsl:with-param name="isMacroReport" select="$isMacroReport" />
<xsl:with-param name="isMainReport" select="$isMainReport" />
</xsl:call-template>
<variable name="tabellennr" class="java.lang.Integer">
<variableExpression><xsl:value-of select="$ergebniselementOrdnr"/></variableExpression>
</variable>
<xsl:call-template name="generateGroupHeaderBandSimple">
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="std_zeilenhoehe_header" select="$std_zeilenhoehe_header" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite" />
</xsl:call-template>
<xsl:if test="$isMainReport='true'">
<xsl:call-template name="generateTitleBand" >
<xsl:with-param name="druckbreite" select="$druckbreite" />
</xsl:call-template>
</xsl:if>
<detail>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]">
<xsl:variable name="flavorTableRowStyle">
<xsl:choose>
<xsl:when test="sqlerg/@istreetable='true'">
<xsl:text>treeTable</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>listAlternatingBg</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<band height="{$std_zeilenhoehe_tablerow}" splitType="Stretch">
<xsl:variable name="colCount"><xsl:value-of select="count(sqlerg/headers/header[not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next')) ])"/></xsl:variable>
<xsl:for-each select="sqlerg/headers/header[not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next')) ]">
<xsl:variable name="columnX">
<xsl:call-template name="getColumnX">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="colCount" select="$colCount"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="columnWidth">
<xsl:call-template name="getColumnwidth">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="colCount" select="$colCount"/>
<xsl:with-param name="previousX" select="$columnX"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$flavorTableRowStyle='listAlternatingBg'">
<xsl:call-template name="jr_textField">
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="fieldName" select="wert" />
<xsl:with-param name="colName" select="f_name" />
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="x" select="$columnX" />
<xsl:with-param name="width" select="$columnWidth" />
<xsl:with-param name="height" select="$std_zeilenhoehe_tablerow" />
<xsl:with-param name="flavorTableRowStyle" select="'listAlternatingBg'" />
<xsl:with-param name="tableRowLevel" select="10" />
</xsl:call-template>
</xsl:when>
<xsl:when test="$flavorTableRowStyle='treeTable'">
<!--10 Ebenen in einer Schleife -->
<xsl:call-template name="jr_textfield_levelx">
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="fieldName" select="wert" />
<xsl:with-param name="colName" select="f_name" />
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="x" select="$columnX" />
<xsl:with-param name="width" select="$columnWidth" />
<xsl:with-param name="std_zeilenhoehe_tablerow" select="$std_zeilenhoehe_tablerow" />
<xsl:with-param name="flavorTableRowStyle" select="'treeTable'" />
<xsl:with-param name="tableRowLevel" select="1" />
<xsl:with-param name="maxLevel" select="10"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- ggf. weitere styles-->
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</band>
</xsl:for-each>
</detail>
</jasperReport>
</xsl:template>
<xsl:template name="jr_properties"><xsl:text>
</xsl:text>
<xsl:comment>Import von jr_properties</xsl:comment>
<property xmlns="http://jasperreports.sourceforge.net/jasperreports" name="net.sf.jasperreports.export.xls.create.custom.palette" value="true"/>
<property xmlns="http://jasperreports.sourceforge.net/jasperreports" name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property xmlns="http://jasperreports.sourceforge.net/jasperreports" name="net.sf.jasperreports.export.xls.remove.empty.space.between.columns" value="true"/>
<property xmlns="http://jasperreports.sourceforge.net/jasperreports" name="net.sf.jasperreports.export.xls.remove.empty.space.between.rows " value="true"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<property name="net.sf.jasperreports.print.create.bookmarks" value="true"/>
</xsl:template>
<xsl:template name="jr_styles">
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:variable name="flavorTableRowStyle">
<xsl:choose>
<xsl:when test="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/@istreetable='true'">
<xsl:text>treeTable</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>listAlternatingBg</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="tableRowStyle">
<xsl:with-param name="flavorTableRowStyle" select="$flavorTableRowStyle" />
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr" />
</xsl:call-template>
</xsl:template>
<xsl:template name="tableRowStyle">
<xsl:param name="flavorTableRowStyle" select="'listAlternatingBg'" />
<xsl:param name="ergebniselementOrdnr" select="0" />
<!--<xsl:if test="$flavorTableRowStyle='listAlternatingBg'">-->
<style name="TableRowDetail" mode="Opaque" forecolor="#000000" backcolor="#FFFFFF" hTextAlign="Right" vTextAlign="Middle" isBlankWhenNull="true" fontName="{$font}" fontSize="8">
<box rightPadding="2">
<pen lineColor="#FFFFFF"/>
</box>
<paragraph leftIndent="2" rightIndent="1" spacingBefore="0" spacingAfter="0"/>
<conditionalStyle>
<conditionExpression><![CDATA[Boolean.valueOf( $V{PAGE_COUNT} % 2 == 1 )]]></conditionExpression>
<style mode="Opaque" forecolor="#000000" backcolor="#E3E8EB"/>
</conditionalStyle>
</style>
<!--</xsl:if>-->
</xsl:template>
<xsl:template name="jr_fields_report_level">
<!-- nun die Felder: zuerst der Berichtsname-->
<field name="REPORT_HEADING_INSTITUTION" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/generalinfo/REPORT_HEADING_INSTITUTION]]></xsl:text></fieldDescription>
</field>
<field name="REPORT_HEADING_URL" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/generalinfo/REPORT_HEADING_URL]]></xsl:text></fieldDescription>
</field>
<field name="REPORT_LOGO_FILE" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/generalinfo/REPORT_LOGO_FILE]]></xsl:text></fieldDescription>
</field>
<field name="REPORT_HEADING_ADRESS" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/generalinfo/REPORT_HEADING_ADRESS]]></xsl:text></fieldDescription>
</field>
<field name="REPORT_EMAIL" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/generalinfo/REPORT_EMAIL]]></xsl:text></fieldDescription>
</field>
<field name="REPORT_DOCUMENTATION_URL" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/generalinfo/REPORT_DOCUMENTATION_URL]]></xsl:text></fieldDescription>
</field>
</xsl:template>
<xsl:template name="jr_fields">
<xsl:param name="ergebniselementOrdnr" select="0"/>
<xsl:param name="isMainReport" />
<xsl:param name="isMacroReport" />
<field name="Berichtsname" class="java.lang.String">
<fieldDescription>
<xsl:choose>
<xsl:when test="$isMacroReport = 'true' and $isMainReport= 'true'">
<xsl:text><![CDATA[/ergebnisse/makro/name]]></xsl:text></xsl:when>
<xsl:otherwise><xsl:text><![CDATA[/ergebnisse/ergebnis[ @ordnr=']]></xsl:text>
<xsl:value-of select="$ergebniselementOrdnr"/>
<xsl:text><![CDATA[']/maskenname]]></xsl:text>
</xsl:otherwise>
</xsl:choose>
</fieldDescription>
</field>
<!-- dann der Erläuterungstext-->
<field name="Erlaeuterung" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis[ @ordnr=']]></xsl:text>
<xsl:value-of select="$ergebniselementOrdnr"/>
<xsl:text><![CDATA[']/explanation]]></xsl:text></fieldDescription>
</field>
<field name="Hinweis" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis[ @ordnr=']]></xsl:text>
<xsl:value-of select="$ergebniselementOrdnr"/>
<xsl:text><![CDATA[']/hinweis]]></xsl:text></fieldDescription>
</field>
<xsl:comment> dann die Tabellenspalten </xsl:comment>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]">
<xsl:variable name="ordnr"><xsl:value-of select="@ordnr"/></xsl:variable>
<xsl:for-each select="sqlerg/complete_headers/header">
<xsl:variable name="jasperFieldname">
<xsl:call-template name="createJasperFieldname">
<xsl:with-param name="fieldName_orig" select="wert"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fldPrefix">
<xsl:if test="$isMacroReport='true'">
<xsl:text>tab_</xsl:text><xsl:value-of select="$ordnr" />
</xsl:if>
</xsl:variable>
<xsl:if test="normalize-space($jasperFieldname)!=''"> <!-- keine leeren Feldnamen-->
<field name="{concat($fldPrefix,$jasperFieldname)}">
<xsl:attribute name="class"><xsl:call-template name="getJavaType">
<xsl:with-param name="ordnr"><xsl:value-of select="$ordnr"/></xsl:with-param>
<xsl:with-param name="col_id"><xsl:value-of select="@id"/></xsl:with-param></xsl:call-template></xsl:attribute>
<fieldDescription><xsl:text><![CDATA[col[@id="]]></xsl:text>
<xsl:value-of select="@id"/><xsl:text><![CDATA[" and wert!=""]]></xsl:text>
<xsl:if test="$isMacroReport='true'">
<xsl:text><![CDATA[ and ../../../@ordnr=']]></xsl:text><xsl:value-of select="$ordnr" /><xsl:text>'</xsl:text>
</xsl:if>
<xsl:text><![CDATA[]/wert]]></xsl:text>
</fieldDescription>
</field>
</xsl:if>
</xsl:for-each>
<!-- dann die Legende pro Unterbericht-->
<xsl:if test="$isMainReport='false'">
<xsl:for-each select="distinct-values(../completefields/feld/@varname)">
<xsl:variable name="jasperFieldname">
<xsl:call-template name="createJasperFieldname">
<xsl:with-param name="fieldName_orig" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="varname">
<xsl:value-of select="." />
</xsl:variable>
<!-- zuerst Label -->
<field name="{concat('legende_',$jasperFieldname,'_label')}" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis[@ordnr=]]></xsl:text><xsl:value-of select="$ordnr"/><xsl:text><![CDATA[]/completefields/feld [@varname="]]></xsl:text><xsl:value-of select="$varname"/><xsl:text><![CDATA["]/@varname]]></xsl:text></fieldDescription>
</field>
<!--dann Wert-->
<field name="{concat('legende_',$jasperFieldname,'_value')}" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis[@ordnr=]]></xsl:text><xsl:value-of select="$ordnr"/><xsl:text><![CDATA[]/felder/feld [@varname="]]></xsl:text><xsl:value-of select="$varname"/><xsl:text><![CDATA["]/value_caption]]></xsl:text></fieldDescription>
</field>
</xsl:for-each>
</xsl:if>
</xsl:for-each><!-- Ende Ergebniselemente -->
<!-- dann die Legende Hauptbericht-->
<xsl:if test="$isMainReport='true'">
<xsl:for-each select="distinct-values(/ergebnisse/ergebnis/completefields/feld/@varname)">
<xsl:variable name="jasperFieldname">
<xsl:call-template name="createJasperFieldname">
<xsl:with-param name="fieldName_orig" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="varname">
<xsl:value-of select="." />
</xsl:variable>
<!-- zuerst Label -->
<field name="{concat('legende_',$jasperFieldname,'_label')}" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis/completefields/feld [@varname="]]></xsl:text><xsl:value-of select="$varname"/><xsl:text><![CDATA["]/@varname]]></xsl:text></fieldDescription>
</field>
<!--dann Wert-->
<field name="{concat('legende_',$jasperFieldname,'_value')}" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis/felder/feld [@varname="]]></xsl:text><xsl:value-of select="$varname"/><xsl:text><![CDATA["]/value_caption]]></xsl:text></fieldDescription>
</field>
</xsl:for-each>
</xsl:if>
<!--Standatum und User:-->
<field name="standdatum" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/ergebnis[ @ordnr='0']/stand]]></xsl:text></fieldDescription>
</field>
<field name="user" class="java.lang.String">
<fieldDescription><xsl:text><![CDATA[/ergebnisse/user]]></xsl:text></fieldDescription>
</field>
</xsl:template>
<xsl:template name="getJavaType">
<xsl:param name="ordnr" />
<xsl:param name="col_id" />
<xsl:choose>
<xsl:when test="count(/ergebnisse/ergebnis/ergebniselement[ @ordnr=$ordnr]/sqlerg/row)=0">
<xsl:text>java.lang.String</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[ @ordnr=$ordnr]/sqlerg/row [@no='0']/col [@id=$col_id]">
<!--Transformation:
3=DecimalFormat
4=integer
-7=Boolean
6=date
8=timestamp
9=time
Default ist
1=string-->
<xsl:choose>
<xsl:when test="@typ='3'"> <!-- DecimalFormat -->
<xsl:text>java.lang.Double</xsl:text>
</xsl:when>
<xsl:when test="@typ='4'"> <!-- Integer -->
<xsl:text>java.lang.Integer</xsl:text>
</xsl:when>
<xsl:when test="@typ='-7'">
<xsl:text>java.lang.Boolean</xsl:text>
</xsl:when>
<xsl:when test="@typ='6'">
<xsl:text>java.util.Date</xsl:text>
</xsl:when>
<xsl:when test="@typ='8'">
<xsl:text>java.sql.Timestamp</xsl:text>
</xsl:when>
<xsl:when test="@typ='9'">
<xsl:text>java.lang.Time</xsl:text>
</xsl:when>
<xsl:otherwise>
<!--Typ=1 ist string und wird defaultmäßig behandelt -->
<xsl:text>java.lang.String</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="createJasperFieldname">
<xsl:param name="fieldName_orig" />
<xsl:variable name="feldname_ohne_umbruch">
<xsl:call-template name="remove_linebreaksAndQuot"><xsl:with-param name="volltext"><xsl:value-of select="$fieldName_orig" /></xsl:with-param></xsl:call-template>
</xsl:variable>
<xsl:variable name="feldnameOhneBackslashN">
<xsl:call-template name="search_replace">
<xsl:with-param name="string"><xsl:value-of select="$feldname_ohne_umbruch" /></xsl:with-param>
<xsl:with-param name="search"><xsl:text>\n</xsl:text></xsl:with-param>
<xsl:with-param name="replace"><xsl:text> </xsl:text></xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="search_replace">
<xsl:with-param name="string"><xsl:value-of select="$feldnameOhneBackslashN" /></xsl:with-param>
<xsl:with-param name="search"><xsl:text>\000</xsl:text></xsl:with-param>
<xsl:with-param name="replace"><xsl:text> </xsl:text></xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="getColumnX">
<xsl:param name="druckbreite"/>
<xsl:param name="std_spaltenbreite"/>
<xsl:param name="ergebniselementOrdnr" />
<xsl:param name="colId" />
<xsl:param name="colCount" />
<xsl:variable name="x"><xsl:text>0</xsl:text>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/headers/header[ @width &gt; 0 and not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next')) and @id &lt; $colId ]">
<xsl:variable name="previousColumnWidth">
<xsl:call-template name="getColumnwidth">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="colCount" select="$colCount"/>
<xsl:with-param name="previousX" select="0"/>
</xsl:call-template>
</xsl:variable>
<xsl:text>+</xsl:text><xsl:value-of select ="$previousColumnWidth" />
</xsl:for-each></xsl:variable>
<!--<xsl:value-of select="sum(for $s in tokenize('1+2+3','+') return number($s))" />-->
<xsl:call-template name="sumStringList">
<xsl:with-param name="pText" select="$x"/>
<xsl:with-param name="pSum" select="0"/>
<xsl:with-param name="pDelim" select="'+'"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="getColumnwidth">
<xsl:param name="druckbreite" />
<xsl:param name="std_spaltenbreite" />
<xsl:param name="ergebniselementOrdnr" />
<xsl:param name="colId" />
<xsl:param name="colCount" />
<xsl:param name="previousX" />
<xsl:variable name="defbreite"><xsl:value-of select="sum(/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/headers/header[ @width &gt; 0 and not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next')) ]/@width )" /></xsl:variable>
<xsl:variable name="ndefbreite"><xsl:value-of select="count(/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/headers/header[ @width = '' and not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next'))])" /></xsl:variable>
<xsl:variable name="gesamtbreite"><xsl:value-of select="$defbreite+($ndefbreite* $std_spaltenbreite)" /></xsl:variable>
<xsl:variable name="width"><xsl:value-of select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebniselementOrdnr]/sqlerg/headers/header[@id=$colId]/@width"/></xsl:variable>
<xsl:comment><xsl:value-of select="concat('defbreite=',$defbreite)" /></xsl:comment>
<xsl:choose>
<xsl:when test="($colCount - 1) =$colId ">
<!-- letzte Spalte -->
<xsl:value-of select="$druckbreite - $previousX"/>
</xsl:when>
<xsl:when test="$width != ''">
<xsl:variable name="spbreite"><xsl:value-of select="$druckbreite*($width div $gesamtbreite)" />
</xsl:variable>
<xsl:choose>
<xsl:when test="$spbreite &gt; 2">
<xsl:value-of select="round($spbreite)" />
</xsl:when>
<xsl:otherwise>
<xsl:text>12</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($druckbreite*($std_spaltenbreite div $gesamtbreite))" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="sumStringList">
<xsl:param name="pText" select="."/>
<xsl:param name="pSum" select="0"/>
<xsl:param name="pDelim" select="'+'"/>
<xsl:choose>
<xsl:when test="not(string-length($pText) >0)">
<xsl:value-of select="$pSum"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="vnewList"
select="concat($pText,$pDelim)"/>
<xsl:variable name="vHead" select=
"substring-before($vnewList, $pDelim)"/>
<xsl:call-template name="sumStringList">
<xsl:with-param name="pText" select=
"substring-after($pText, $pDelim)"/>
<xsl:with-param name="pSum" select="$pSum+$vHead"/>
<xsl:with-param name="pDelim" select="$pDelim"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="jr_textField">
<xsl:param name="ergebnisElementOrdnr" />
<xsl:param name="fieldName" />
<xsl:param name="colName" />
<xsl:param name="colId" />
<xsl:param name="x" select="'0'" />
<xsl:param name="width" select="'0'" />
<xsl:param name="height" select="'30'" />
<xsl:param name="flavorTableRowStyle" select="'listAlternatingBg'" />
<xsl:param name="tableRowLevel" select="10" />
<xsl:variable name="jasperFieldname">
<xsl:call-template name="createJasperFieldname">
<xsl:with-param name="fieldName_orig" select="$fieldName"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="fldPrefix">
<xsl:choose>
<xsl:when test="/ergebnisse/@isMakro='true'">
<xsl:text>tab_</xsl:text><xsl:value-of select="$ergebnisElementOrdnr" /></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="fieldType">
<xsl:call-template name="getFieldType">
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr" />
<xsl:with-param name="colId" select="$colId" />
</xsl:call-template>
</xsl:variable>
<!--start Feldausgabe, zuerst prüfen ob besonderer Feldname-->
<xsl:choose>
<xsl:when test="normalize-space($jasperFieldname)=''"> <!-- keine leeren Feldnamen-->
</xsl:when>
<xsl:when test="starts-with($colName,'_graph')">
<xsl:variable name="alignLeft">
<xsl:choose>
<xsl:when test="starts-with($colName,'_graphbarright')">
<xsl:text>false</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>true</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<image scaleImage="RealSize" evaluationTime="Band">
<reportElement x="{$x}" y="0" width="{$width}" height="{$height}" />
<imageExpression><xsl:text><![CDATA[net.sf.jasperreports.renderers.SimpleDataRenderer.getInstance(de.superx.rpta.SvgProducer.SimpleBarChart($F{]]></xsl:text><xsl:value-of select="$jasperFieldname" />
<xsl:text>},100,</xsl:text>
<xsl:value-of select="$width"/><xsl:text>,</xsl:text>
<xsl:value-of select="$height"/><xsl:text>,"#cccccc","steelblue",</xsl:text>
<xsl:value-of select="$alignLeft"/><xsl:text>).getBytes("UTF-8"))</xsl:text></imageExpression>
</image>
</xsl:when>
<xsl:otherwise>
<!-- normales Textfeld: -->
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement stretchType="ContainerHeight" x="{$x}" y="0" width="{$width}" height="{$height}" >
<xsl:attribute name="style">
<xsl:call-template name="getTableRowStyle" >
<xsl:with-param name="flavorTableRowStyle" select="$flavorTableRowStyle"/>
<xsl:with-param name="tableRowLevel" select="$tableRowLevel"/>
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr" />
<xsl:with-param name="fieldType" select="$fieldType" />
</xsl:call-template>
</xsl:attribute>
<xsl:if test="$flavorTableRowStyle='treeTable'">
<xsl:variable name="ColNameEbene">
<xsl:call-template name="getColNameEbene">
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr" />
</xsl:call-template>
</xsl:variable>
<printWhenExpression><xsl:value-of select="concat('$F{',$ColNameEbene,'}==',$tableRowLevel)" /></printWhenExpression>
</xsl:if>
</reportElement>
<xsl:if test="$fieldType!='3' and $fieldType!='4' "><!--Zahlen immer rechtsbündig, alles andere links-->
<textElement textAlignment="Left"/>
</xsl:if>
<textFieldExpression><xsl:value-of select="concat('$F{',$fldPrefix,$jasperFieldname,'}')" /></textFieldExpression>
<xsl:call-template name="tableCellPatternExpression">
<xsl:with-param name="fieldType" select="$fieldType" />
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr"/>
<xsl:with-param name="fieldName" select="$fieldName" />
</xsl:call-template>
</textField>
</xsl:otherwise><!-- ende normales Textfeld-->
</xsl:choose>
</xsl:template>
<xsl:template name="getFieldType">
<xsl:param name="ergebnisElementOrdnr" />
<xsl:param name="colId" />
<xsl:value-of select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebnisElementOrdnr]/sqlerg/row[@no='0']/col[@id=$colId]/@typ" />
</xsl:template>
<xsl:template name="getLegendExpression">
<xsl:param name="ergebniselementOrdnr" select="0"/>
<xsl:text>""</xsl:text>
<!-- <xsl:for-each select="distinct-values(//ergebnisse/ergebnis[@ordnr = 1 ]/completefields/feld/@varname)">-->
<xsl:for-each select="/ergebnisse/ergebnis[@ordnr = $ergebniselementOrdnr ]/felder/feld/@varname">
<xsl:variable name="jasperFieldname">
<xsl:call-template name="createJasperFieldname">
<xsl:with-param name="fieldName_orig" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="varname">
<xsl:value-of select="." />
</xsl:variable>
<xsl:value-of select="concat('+(($F{','legende_',$jasperFieldname,'_value','}==null || $F{','legende_',$jasperFieldname,'_value','}==&quot;&quot;)?','&quot;&quot;:(')" />
<xsl:value-of select="concat('$F{','legende_',$jasperFieldname,'_label','}')" /><xsl:text>+": "+</xsl:text>
<xsl:value-of select="concat('$F{','legende_',$jasperFieldname,'_value','}')" /><xsl:text>+"; "))
</xsl:text>
</xsl:for-each>
</xsl:template>
<xsl:template name="generateTableHeader">
<xsl:param name="druckbreite" />
<xsl:param name="std_spaltenbreite" />
<xsl:param name="zeilenhoehe" select="30" />
<xsl:param name="ordnr" select="0"/>
<xsl:param name="y_offset" select="0"/>
<xsl:for-each select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ordnr]">
<xsl:choose>
<xsl:when test="sqlerg/headers/@hasAggregationHeaders='true'" >
<!-- verschachtelter Header -->
<xsl:variable name="totalColCount"><xsl:value-of select="sqlerg/headers/@count"/></xsl:variable>
<xsl:variable name="rowCount"><xsl:value-of select="count(sqlerg/aggregationHeaders/tr)"/></xsl:variable>
<xsl:for-each select="sqlerg/aggregationHeaders/tr">
<xsl:variable name="rowCounter" select="position()-1" />
<xsl:variable name="currentRowColCount"><xsl:value-of select="count(th[ @isHidden='false'])"/></xsl:variable>
<xsl:variable name="colCount">
<xsl:choose>
<xsl:when test="($rowCounter - 1)=$rowCount">
<xsl:value-of select="$totalColCount"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$totalColCount"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:for-each select="th" >
<xsl:variable name="colId"><xsl:value-of select="position()-1" /></xsl:variable>
<xsl:if test="@isHidden='false'">
<xsl:comment><xsl:text>colId=</xsl:text><xsl:value-of select="$colId"/></xsl:comment>
<xsl:variable name="columnX">
<xsl:call-template name="getColumnX">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ordnr"/>
<xsl:with-param name="colId" select="$colId" />
<xsl:with-param name="colCount" select="$colCount"/>
</xsl:call-template>
</xsl:variable>
<xsl:comment><xsl:text>columnX=</xsl:text><xsl:value-of select="$columnX"/></xsl:comment>
<xsl:comment><xsl:text>colCount=</xsl:text><xsl:value-of select="$colCount"/></xsl:comment>
<xsl:comment><xsl:text>druckbreite=</xsl:text><xsl:value-of select="$druckbreite"/></xsl:comment>
<xsl:variable name="columnWidth">
<xsl:call-template name="getColumnwidth">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ordnr"/>
<xsl:with-param name="colId" select="$colId" />
<xsl:with-param name="colCount" select="$colCount"/>
<xsl:with-param name="previousX" select="$columnX"/>
</xsl:call-template>
</xsl:variable>
<xsl:comment><xsl:text>columnWidth=</xsl:text><xsl:value-of select="$columnWidth"/></xsl:comment>
<xsl:variable name="rowspan">
<xsl:choose>
<xsl:when test="@rowspan &gt;1">
<xsl:value-of select="@rowspan"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>1</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="colspan">
<xsl:choose>
<xsl:when test="@colspan &gt;1">
<xsl:value-of select="@colspan"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>1</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<textField isStretchWithOverflow="true">
<reportElement style="TableColumnHeader" mode="Opaque" stretchType="ContainerHeight"
x="{$columnX}" y="{$y_offset+( $rowCounter * $zeilenhoehe )}" width="{$columnWidth * $colspan}" height="{$zeilenhoehe*$rowspan}" />
<textFieldExpression><xsl:text>"</xsl:text>
<xsl:call-template name="newline_to_backslash_n">
<xsl:with-param name="string" select="."/>
</xsl:call-template>
<xsl:text>"</xsl:text>
</textFieldExpression>
</textField>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="colCount"><xsl:value-of select="count(sqlerg/headers/header[not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next')) ])"/></xsl:variable>
<xsl:for-each select="sqlerg/headers/header[not(starts-with(f_name,'hidden')) and not(starts-with(f_name,'next')) ]">
<xsl:variable name="columnX">
<xsl:call-template name="getColumnX">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ordnr"/>
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="colCount" select="$colCount"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="columnWidth">
<xsl:call-template name="getColumnwidth">
<xsl:with-param name="druckbreite" select="$druckbreite"/>
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="ergebniselementOrdnr" select="$ordnr"/>
<xsl:with-param name="colId" select="@id" />
<xsl:with-param name="colCount" select="$colCount"/>
<xsl:with-param name="previousX" select="$columnX"/>
</xsl:call-template>
</xsl:variable>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" style="TableColumnHeader" mode="Opaque" stretchType="ContainerHeight"
x="{$columnX}" y="{$y_offset}" width="{$columnWidth}" height="{$zeilenhoehe}" />
<textFieldExpression><xsl:text>"</xsl:text><!--<xsl:call-template name="getColHeaderText">
<xsl:with-param name="header_wert" select="." /></xsl:call-template>-->
<xsl:call-template name="newline_to_backslash_n">
<xsl:with-param name="string" select="wert"/>
</xsl:call-template>
<xsl:text>"</xsl:text>
</textFieldExpression>
</textField>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="getZeilenhoeheTableHeader">
<xsl:param name="ordnr" select="0" />
<xsl:param name="std_zeilenhoehe_header" select="30" />
<xsl:param name="y_offset" select="0" />
<xsl:choose>
<xsl:when test="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ordnr]/sqlerg/headers/@hasAggregationHeaders='true'">
<xsl:variable name="maxRownumberTableHeader">
<xsl:value-of select="count(/ergebnisse/ergebnis/ergebniselement[@ordnr=$ordnr]/sqlerg/aggregationHeaders/tr)"/>
</xsl:variable>
<xsl:value-of select="$y_offset + ( $std_zeilenhoehe_header * $maxRownumberTableHeader )"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$y_offset + $std_zeilenhoehe_header "/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="generateGroupHeaderBandSimple">
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:param name="std_zeilenhoehe_header" />
<xsl:param name="druckbreite" />
<xsl:param name="std_spaltenbreite" />
<xsl:variable name="isMacroReport" select="/ergebnisse/@isMakro" />
<xsl:variable name="legendLabelHeight" select="20" />
<xsl:variable name="legendContentHeight" select="10" />
<xsl:variable name="hinweisContentHeight" select="10" />
<xsl:variable name="subReportTitleHeight">
<xsl:choose>
<xsl:when test="$isMacroReport='false'">
<xsl:text>0</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>20</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<group name="tabellennr">
<groupExpression><![CDATA[$V{tabellennr}]]></groupExpression>
<groupHeader>
<band height="{$legendLabelHeight+$legendContentHeight + $subReportTitleHeight}">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.spreadsheet.SpreadsheetLayout"/>
<!--subReportTitle-->
<xsl:if test="$isMacroReport = 'true'">
<textField>
<reportElement style="subReportTitle" x="0" y="0" width="{$druckbreite}" height="{$subReportTitleHeight}" />
<textFieldExpression><xsl:text>"</xsl:text><xsl:value-of select="/ergebnisse/ergebnis[@ordnr=$ergebniselementOrdnr]/maskenname"/><xsl:text>"</xsl:text></textFieldExpression>
</textField>
</xsl:if>
<!--Legende -->
<xsl:call-template name="legendLabelAndContent">
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="subReportTitleHeight" select="$subReportTitleHeight" />
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="legendLabelHeight" select="$legendLabelHeight" />
<xsl:with-param name="legendContentHeight" select="$legendContentHeight" />
</xsl:call-template>
</band>
<band height="{$hinweisContentHeight}">
<printWhenExpression><![CDATA[$F{Hinweis}.length() >0]]></printWhenExpression>
<!-- hinweis-->
<textField isStretchWithOverflow="true">
<reportElement style="HinweisContent" positionType="Float" isPrintWhenDetailOverflows="true" x="0" y="0" width="{$druckbreite}" height="{$hinweisContentHeight}" />
<box topPadding="10" leftPadding="2" bottomPadding="10" rightPadding="2"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression>
<xsl:text disable-output-escaping="yes"><![CDATA[$F{Hinweis}]]></xsl:text></textFieldExpression>
</textField>
</band>
<!--nun Spaltenüberschriften-->
<band splitType="Stretch">
<xsl:attribute name="height">
<xsl:call-template name="getZeilenhoeheTableHeader">
<xsl:with-param name="ordnr" select="$ergebniselementOrdnr" />
<xsl:with-param name="std_zeilenhoehe_header" select="$std_zeilenhoehe_header" />
<xsl:with-param name="y_offset" select="0"/>
</xsl:call-template>
</xsl:attribute>
<xsl:call-template name="generateTableHeader">
<xsl:with-param name="druckbreite" select="$druckbreite" />
<xsl:with-param name="std_spaltenbreite" select="$std_spaltenbreite"/>
<xsl:with-param name="zeilenhoehe" select="$std_zeilenhoehe_header" />
<xsl:with-param name="ordnr" select="$ergebniselementOrdnr"/>
<xsl:with-param name="y_offset" select="0"/>
</xsl:call-template>
</band>
</groupHeader>
</group>
</xsl:template>
<xsl:template name="generateTitleBand">
<xsl:param name="druckbreite" select="812" />
<title>
<band height="75">
<textField>
<reportElement x="0" y="0" width="{$druckbreite}" height="30" style="ReportHeadingInstitution"/>
<textFieldExpression><![CDATA[$F{REPORT_HEADING_INSTITUTION} + " | "+ $F{user}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="ReportTitle" x="0" y="30" width="{$druckbreite}" height="45" />
<textFieldExpression><![CDATA[$F{Berichtsname}]]></textFieldExpression>
</textField>
</band>
</title>
</xsl:template>
<!-- start value-->
<xsl:template name="jr_textfield_levelx">
<xsl:param name="ergebnisElementOrdnr" />
<xsl:param name="fieldName" />
<xsl:param name="colName" />
<xsl:param name="colId" />
<xsl:param name="x" />
<xsl:param name="width" />
<xsl:param name="flavorTableRowStyle" />
<xsl:param name="tableRowLevel" />
<xsl:param name="std_zeilenhoehe_tablerow" select="25" />
<xsl:param name="maxLevel" select="10"/>
<xsl:if test="$tableRowLevel &lt;= $maxLevel">
<xsl:call-template name="jr_textField">
<xsl:with-param name="tableRowLevel" select="$tableRowLevel" />
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr" />
<xsl:with-param name="fieldName" select="$fieldName" />
<xsl:with-param name="colName" select="$colName" />
<xsl:with-param name="colId" select="$colId" />
<xsl:with-param name="x" select="$x" />
<xsl:with-param name="width" select="$width" />
<xsl:with-param name="height" select="$std_zeilenhoehe_tablerow" />
<xsl:with-param name="flavorTableRowStyle" select="$flavorTableRowStyle" />
</xsl:call-template>
<xsl:call-template name="jr_textfield_levelx">
<xsl:with-param name="maxLevel" select="$maxLevel"/>
<xsl:with-param name="ergebnisElementOrdnr" select="$ergebnisElementOrdnr" />
<xsl:with-param name="fieldName" select="$fieldName" />
<xsl:with-param name="colName" select="$colName" />
<xsl:with-param name="colId" select="$colId" />
<xsl:with-param name="x" select="$x" />
<xsl:with-param name="width" select="$width" />
<xsl:with-param name="std_zeilenhoehe_tablerow" select="$std_zeilenhoehe_tablerow" />
<xsl:with-param name="flavorTableRowStyle" select="$flavorTableRowStyle" />
<xsl:with-param name="tableRowLevel" select="$tableRowLevel + 1" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="getTableRowStyle">
<xsl:param name="flavorTableRowStyle"/>
<xsl:param name="tableRowLevel"/>
<xsl:param name="ergebnisElementOrdnr" select="0" />
<xsl:param name="fieldType" />
<xsl:choose>
<xsl:when test="$flavorTableRowStyle='listAlternatingBg'">
<xsl:text>TableRowDetail</xsl:text>
</xsl:when>
<xsl:when test="$flavorTableRowStyle='treeTable'">
<xsl:value-of select="concat('TableRowLevel',$tableRowLevel)" />
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="querystring">
<xsl:param name="ordnr" select="'0'" />
<xsl:param name="rownr" />
<xsl:variable name="quote"><xsl:text>'</xsl:text></xsl:variable>
<xsl:variable name="rowfilter">
<xsl:choose>
<xsl:when test="$rownr &gt; 0">
<xsl:text>[position() = </xsl:text><xsl:value-of select="$rownr"/><xsl:text> ]</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<queryString language="xPath"><xsl:value-of select="concat('/ergebnisse/ergebnis/ergebniselement[@ordnr=',$quote,$ordnr,$quote,']/sqlerg/row',$rowfilter)" />
</queryString>
</xsl:template>
<xsl:template name="createExcelSheetname">
<!-- kopiert von de.superx.servlet.XmlTransformer.createExcelSheetname(String)-->
<xsl:param name="mystring" />
<xsl:variable name="s1">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$mystring" />
<xsl:with-param name="search" select="'/'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s2">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s1" />
<xsl:with-param name="search" select="'\'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s3">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s2" />
<xsl:with-param name="search" select="'?'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s4">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s3" />
<xsl:with-param name="search" select="'*'" />
<xsl:with-param name="replace" select="'_'" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s5">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s4" />
<xsl:with-param name="search" select="'['" />
<xsl:with-param name="replace" select="'('" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="s6">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$s5" />
<xsl:with-param name="search" select="']'" />
<xsl:with-param name="replace" select="')'" />
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="trunc_string">
<xsl:with-param name="maxlength" select="27" />
<xsl:with-param name="mystring" select="$s6"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="trunc_string">
<xsl:param name="maxlength" select="28" />
<xsl:param name="mystring" />
<xsl:choose><xsl:when test="string-length($mystring) &gt; $maxlength">
<xsl:variable name="ceiling_length"><xsl:value-of select="$maxlength - 3"/></xsl:variable>
<xsl:value-of select="concat(substring($mystring,0,$ceiling_length ),'...')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$mystring"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="getColNameEbene">
<xsl:param name="ergebnisElementOrdnr" select="0" />
<xsl:choose>
<xsl:when test="/ergebnisse/@isMakro='true'">
<xsl:value-of select="concat('tab_',$ergebnisElementOrdnr,/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebnisElementOrdnr]/sqlerg/headers/header[f_name='ebene']/wert)" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/ergebnisse/ergebnis/ergebniselement[@ordnr=$ergebnisElementOrdnr]/sqlerg/headers/header[f_name='ebene']/wert" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="getColHeaderText">
<xsl:param name="header_wert" />
<xsl:choose>
<xsl:when test="contains($header_wert,'\n')">
<xsl:call-template name="search_replace">
<xsl:with-param name="string" select="$header_wert" />
<xsl:with-param name="search" select="'\n'"/>
<xsl:with-param name="replace" select="'&#10;'"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$header_wert" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="tableCellPatternExpression">
<xsl:param name="fieldType" />
<xsl:param name="ergebnisElementOrdnr"/>
<xsl:param name="fieldName" />
<patternExpression>
<xsl:choose>
<xsl:when test="$fieldType='4'"> <!--integer-->
<xsl:text>"#,##0"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='3'"> <!--decimal-->
<xsl:text>"#,##0.00;-#,##0.00"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='6'"> <!--date-->
<xsl:text>"dd.MM.yyyy"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='8'"> <!--timestamp-->
<xsl:text>"dd.MM.yyyy hh:mm:ss"</xsl:text>
</xsl:when>
<xsl:when test="$fieldType='9'"> <!--time-->
<xsl:text>"hh:mm:ss"</xsl:text>
</xsl:when>
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</patternExpression>
</xsl:template>
<xsl:template name="newline_to_backslash_n">
<xsl:param name="string"/>
<xsl:choose>
<xsl:when test="contains($string,'&#10;')">
<xsl:value-of select="substring-before($string,'&#10;')"/>
<xsl:text>\n</xsl:text>
<xsl:call-template name="newline_to_backslash_n">
<xsl:with-param name="string" select="substring-after($string,'&#10;')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$string"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="legendLabelAndContent">
<xsl:param name="ergebniselementOrdnr" select="0" />
<xsl:param name="subReportTitleHeight" select="10" />
<xsl:param name="druckbreite" select="842" />
<xsl:param name="legendLabelHeight" select="10" />
<xsl:param name="legendContentHeight" select="50" />
<textField>
<reportElement style="LegendLabel" x="0" y="{$subReportTitleHeight}" width="{$druckbreite}" height="{$legendLabelHeight}" />
<textElement verticalAlignment="Bottom">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Filterkriterien: "]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement style="LegendContent" isPrintWhenDetailOverflows="true" x="0" y="{$subReportTitleHeight + $legendLabelHeight}" width="{$druckbreite}" height="{$legendContentHeight}" />
<box topPadding="10" leftPadding="2" bottomPadding="10" rightPadding="2"/>
<textFieldExpression>
<xsl:call-template name="getLegendExpression">
<xsl:with-param name="ergebniselementOrdnr" select="$ergebniselementOrdnr"/>
</xsl:call-template>
<xsl:text disable-output-escaping="yes"><![CDATA[ +"Datenstand: "+ $F{standdatum} + "; " + "Erstellt: "+ DATEFORMAT( TODAY(), "dd.MM.YYYY")]]></xsl:text></textFieldExpression>
</textField>
</xsl:template>
</xsl:stylesheet>