sunyj 8 лет назад
Родитель
Сommit
edf2ac9854
1 измененных файлов с 879 добавлено и 40 удалено
  1. 879 40
      src/main/resources/crystal2jasper.xsl

+ 879 - 40
src/main/resources/crystal2jasper.xsl

@@ -2,8 +2,10 @@
 <xsl:stylesheet version="1.0"
 	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:inet="http://www.inetsoftware.de">
 	<xsl:output method="xml" version="1.0" encoding="UTF-8"
-		indent="yes" cdata-section-elements="parameterDescription queryString text textFieldExpression" />
+		indent="yes"
+		cdata-section-elements="parameterDescription defaultValueExpression queryString text textFieldExpression subreportParameterExpression connectionExpression subreportExpression" />
 	<xsl:template match="inet:Report">
+		<!-- position rate from crystal to jasper -->
 		<xsl:variable name="positionRate">
 			15
 		</xsl:variable>
@@ -36,13 +38,40 @@
 
 			<!-- parameters -->
 			<parameter name="WHERE_CONDITION" class="java.lang.String">
-				<parameterDescription><![CDATA[where子句]]></parameterDescription>
-				<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
+				<parameterDescription>where子句</parameterDescription>
+				<defaultValueExpression>"where rownum&lt;=1"
+				</defaultValueExpression>
 			</parameter>
 			<parameter name="REPORT_DIR" class="java.lang.String">
-				<parameterDescription><![CDATA[报表的路径]]></parameterDescription>
-				<defaultValueExpression><![CDATA[""]]></defaultValueExpression>
+				<parameterDescription>报表的路径</parameterDescription>
+				<defaultValueExpression>"/mnt/data/reports"</defaultValueExpression>
 			</parameter>
+			<!-- subreport parameters -->
+			<xsl:for-each select="PromptFields/Field[@type='PromptVarField']">
+				<xsl:variable name="name"
+					select="substring-after(substring-after(Name/@value,'Pm-'),'.')" />
+				<xsl:if test="$name">
+					<parameter>
+						<xsl:variable name="type" select="@valueType" />
+						<!-- name -->
+						<xsl:attribute name="name"><xsl:value-of
+							select="$name" /></xsl:attribute>
+						<!-- class -->
+						<xsl:attribute name="class">
+						<xsl:choose>
+							<xsl:when test="$type='6'">java.math.BigDecimal</xsl:when>
+							<xsl:when test="$type='9'">java.sql.Timestamp</xsl:when>
+							<xsl:when test="$type='11'">java.lang.String</xsl:when>
+							<xsl:when test="$type='15'">java.sql.Timestamp</xsl:when>
+						</xsl:choose>
+					</xsl:attribute>
+						<!-- default value -->
+						<defaultValueExpression>
+							<xsl:value-of select="concat('$P{',$name,'}')" />
+						</defaultValueExpression>
+					</parameter>
+				</xsl:if>
+			</xsl:for-each>
 
 			<queryString>
 				select * from dual;
@@ -54,7 +83,7 @@
 					<xsl:attribute name="name"><xsl:value-of
 						select="@name" /></xsl:attribute>
 					<xsl:attribute name="class">
-						<xsl:variable name="type" select="@type"></xsl:variable>
+						<xsl:variable name="type" select="@type" />
 						<xsl:choose>
 							<xsl:when test="$type='6'">java.math.BigDecimal</xsl:when>
 							<xsl:when test="$type='9'">java.sql.Timestamp</xsl:when>
@@ -71,6 +100,241 @@
 					<band splitType="Stretch">
 						<xsl:attribute name="height"><xsl:value-of
 							select="round(AreaPair[@type='ReportAreaPair']/Area[@type='ReportHeader']/Section/@height div $positionRate)" /></xsl:attribute>
+						<xsl:for-each
+							select="AreaPair[@type='ReportAreaPair']/Area[@type='ReportHeader']/Section/Element">
+							<xsl:variable name="type" select="@type" />
+							<xsl:choose>
+								<xsl:when test="$type='Box'"></xsl:when>
+								<xsl:when test="$type='Line'"></xsl:when>
+								<!-- staticText -->
+								<xsl:when test="$type='Text'">
+									<staticText>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- border -->
+										<box topPadding="2" leftPadding="2" bottomPadding="2"
+											rightPadding="2">
+											<pen lineWidth="0.2" />
+											<topPen lineWidth="0.2" />
+											<leftPen lineWidth="0.2" />
+											<bottomPen lineWidth="0.2" />
+											<rightPen lineWidth="0.2" />
+										</box>
+										<!-- align -->
+										<textElement verticalAlignment="Middle">
+											<xsl:variable name="textAlignment"
+												select="CommonProperties/HorizontalAlign/@value" />
+											<!-- horizontal align -->
+											<xsl:if test="$textAlignment">
+												<xsl:attribute name="textAlignment">
+													<xsl:choose>
+														<xsl:when test="$textAlignment='1'">Left</xsl:when>
+														<xsl:when test="$textAlignment='2'">Center</xsl:when>
+														<xsl:when test="$textAlignment='3'">Right</xsl:when>
+													</xsl:choose>
+												</xsl:attribute>
+											</xsl:if>
+											<!-- font -->
+											<font fontName="Microsoft YaHei UI">
+												<!-- font size -->
+												<xsl:if test="FontProperties/FontSize">
+													<xsl:attribute name="size"><xsl:value-of
+														select="round(Element/Element/FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
+												</xsl:if>
+												<!-- font style -->
+												<xsl:variable name="fontStyle"
+													select="Element/Element/FontProperties/FontStyle/@value" />
+												<xsl:choose>
+													<xsl:when test="$fontStyle mod 4 ='1'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='2'">
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='3'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+												</xsl:choose>
+												<!-- font underline -->
+												<xsl:if test="Element/Element/FontProperties/Underline/@value">
+													<xsl:attribute name="isUnderline">true</xsl:attribute>
+												</xsl:if>
+												<!-- font strikethrough -->
+												<xsl:if test="Element/Element/FontProperties/Strikeout/@value">
+													<xsl:attribute name="isStrikeThrough">true</xsl:attribute>
+												</xsl:if>
+											</font>
+										</textElement>
+										<text>
+											<xsl:value-of select="Element/Element/TextData" />
+										</text>
+									</staticText>
+								</xsl:when>
+								<!-- textField -->
+								<xsl:when test="$type='FieldElement'">
+									<textField isBlankWhenNull="true">
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- border -->
+										<box topPadding="2" leftPadding="2" bottomPadding="2"
+											rightPadding="2">
+											<pen lineWidth="0.2" />
+											<topPen lineWidth="0.2" />
+											<leftPen lineWidth="0.2" />
+											<bottomPen lineWidth="0.2" />
+											<rightPen lineWidth="0.2" />
+										</box>
+										<!-- align -->
+										<textElement verticalAlignment="Middle">
+											<xsl:variable name="textAlignment"
+												select="CommonProperties/HorizontalAlign/@value" />
+											<!-- horizontal align -->
+											<xsl:if test="$textAlignment">
+												<xsl:attribute name="textAlignment">
+													<xsl:choose>
+														<xsl:when test="$textAlignment='1'">Left</xsl:when>
+														<xsl:when test="$textAlignment='2'">Center</xsl:when>
+														<xsl:when test="$textAlignment='3'">Right</xsl:when>
+													</xsl:choose>
+												</xsl:attribute>
+											</xsl:if>
+											<!-- font -->
+											<font fontName="Microsoft YaHei UI">
+												<!-- font size -->
+												<xsl:if test="FontProperties/FontSize">
+													<xsl:attribute name="size"><xsl:value-of
+														select="round(FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
+												</xsl:if>
+												<!-- font style -->
+												<xsl:variable name="fontStyle"
+													select="FontProperties/FontStyle/@value" />
+												<xsl:choose>
+													<xsl:when test="$fontStyle mod 4 ='1'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='2'">
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='3'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+												</xsl:choose>
+												<!-- font underline -->
+												<xsl:if test="FontProperties/Underline/@value">
+													<xsl:attribute name="isUnderline">true</xsl:attribute>
+												</xsl:if>
+												<!-- font strikethrough -->
+												<xsl:if test="FontProperties/Strikeout/@value">
+													<xsl:attribute name="isStrikeThrough">true</xsl:attribute>
+												</xsl:if>
+											</font>
+										</textElement>
+										<!-- textFieldExpression -->
+										<xsl:if test="Reference">
+											<xsl:variable name="type" select="Reference/@type" />
+											<xsl:variable name="value" select="Reference/@value" />
+											<textFieldExpression>
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:value-of
+															select="concat('$F{',substring-after($value,'.'),'}')" />
+													</xsl:when>
+													<xsl:when test="$type='FormulaField'">
+														<xsl:value-of select="concat('@FormulaField ',$value)" />
+													</xsl:when>
+													<xsl:when test="$type='SpecialVarField'">
+														<xsl:value-of select="concat('@SpecialVarField ',$value)" />
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:value-of select="concat('@Unknown ',$value)" />
+													</xsl:otherwise>
+												</xsl:choose>
+											</textFieldExpression>
+										</xsl:if>
+									</textField>
+								</xsl:when>
+								<!-- subreport -->
+								<xsl:when test="$type='Subreport'">
+									<subreport>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- subreportParameter -->
+										<xsl:for-each select="SubreportLinks/SubreportLink">
+											<subreportParameter>
+												<xsl:variable name="type" select="Reference/@type" />
+												<xsl:variable name="value" select="Reference/@value" />
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:attribute name="name">
+															<xsl:value-of select="substring-after($value,'.')" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of
+																select="concat('$F{',substring-after($value,'.'),'}')" />
+														</subreportParameterExpression>
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:attribute name="name">
+															<xsl:value-of select="$value" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of select="concat('@Unknown ',$value)" />
+														</subreportParameterExpression>
+													</xsl:otherwise>
+												</xsl:choose>
+											</subreportParameter>
+										</xsl:for-each>
+										<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
+										<!-- sub id <= replace with report name -->
+										<id>
+											<xsl:value-of select="SubreportProperties/Id/@value" />
+										</id>
+										<subreportExpression></subreportExpression>
+									</subreport>
+								</xsl:when>
+							</xsl:choose>
+						</xsl:for-each>
 					</band>
 				</title>
 			</xsl:if>
@@ -83,7 +347,7 @@
 							select="round(AreaPair[@type='PageAreaPair']/Area[@type='PageHeader']/Section/@height div $positionRate)" /></xsl:attribute>
 						<xsl:for-each
 							select="AreaPair[@type='PageAreaPair']/Area[@type='PageHeader']/Section/Element">
-							<xsl:variable name="type" select="@type"></xsl:variable>
+							<xsl:variable name="type" select="@type" />
 							<xsl:choose>
 								<xsl:when test="$type='Box'"></xsl:when>
 								<xsl:when test="$type='Line'"></xsl:when>
@@ -117,7 +381,7 @@
 										<!-- align -->
 										<textElement verticalAlignment="Middle">
 											<xsl:variable name="textAlignment"
-												select="CommonProperties/HorizontalAlign/@value"></xsl:variable>
+												select="CommonProperties/HorizontalAlign/@value" />
 											<!-- horizontal align -->
 											<xsl:if test="$textAlignment">
 												<xsl:attribute name="textAlignment">
@@ -137,7 +401,7 @@
 												</xsl:if>
 												<!-- font style -->
 												<xsl:variable name="fontStyle"
-													select="Element/Element/FontProperties/FontStyle/@value"></xsl:variable>
+													select="Element/Element/FontProperties/FontStyle/@value" />
 												<xsl:choose>
 													<xsl:when test="$fontStyle mod 4 ='1'">
 														<xsl:attribute name="isBold">true</xsl:attribute>
@@ -195,7 +459,7 @@
 										<!-- align -->
 										<textElement verticalAlignment="Middle">
 											<xsl:variable name="textAlignment"
-												select="CommonProperties/HorizontalAlign/@value"></xsl:variable>
+												select="CommonProperties/HorizontalAlign/@value" />
 											<!-- horizontal align -->
 											<xsl:if test="$textAlignment">
 												<xsl:attribute name="textAlignment">
@@ -215,7 +479,7 @@
 												</xsl:if>
 												<!-- font style -->
 												<xsl:variable name="fontStyle"
-													select="FontProperties/FontStyle/@value"></xsl:variable>
+													select="FontProperties/FontStyle/@value" />
 												<xsl:choose>
 													<xsl:when test="$fontStyle mod 4 ='1'">
 														<xsl:attribute name="isBold">true</xsl:attribute>
@@ -240,28 +504,80 @@
 										</textElement>
 										<!-- textFieldExpression -->
 										<xsl:if test="Reference">
-											<xsl:variable name="type" select="Reference/@type"></xsl:variable>
-											<xsl:variable name="value" select="Reference/@value"></xsl:variable>
+											<xsl:variable name="type" select="Reference/@type" />
+											<xsl:variable name="value" select="Reference/@value" />
 											<textFieldExpression>
 												<xsl:choose>
 													<xsl:when test="$type='DatabaseField'">
 														<xsl:value-of
-															select="concat('$F{',substring-after($value,'.'),'}')"></xsl:value-of>
+															select="concat('$F{',substring-after($value,'.'),'}')" />
 													</xsl:when>
 													<xsl:when test="$type='FormulaField'">
-														<xsl:value-of select="concat('@FormulaField ',$value)"></xsl:value-of>
+														<xsl:value-of select="concat('@FormulaField ',$value)" />
 													</xsl:when>
 													<xsl:when test="$type='SpecialVarField'">
-														<xsl:value-of select="concat('@SpecialVarField ',$value)"></xsl:value-of>
+														<xsl:value-of select="concat('@SpecialVarField ',$value)" />
 													</xsl:when>
 													<xsl:otherwise>
-														<xsl:value-of select="concat('@Unknown ',$value)"></xsl:value-of>
+														<xsl:value-of select="concat('@Unknown ',$value)" />
 													</xsl:otherwise>
 												</xsl:choose>
 											</textFieldExpression>
 										</xsl:if>
 									</textField>
 								</xsl:when>
+								<!-- subreport -->
+								<xsl:when test="$type='Subreport'">
+									<subreport>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- subreportParameter -->
+										<xsl:for-each select="SubreportLinks/SubreportLink">
+											<subreportParameter>
+												<xsl:variable name="type" select="Reference/@type" />
+												<xsl:variable name="value" select="Reference/@value" />
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:attribute name="name">
+															<xsl:value-of select="substring-after($value,'.')" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of
+																select="concat('$F{',substring-after($value,'.'),'}')" />
+														</subreportParameterExpression>
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:attribute name="name">
+															<xsl:value-of select="$value" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of select="concat('@Unknown ',$value)" />
+														</subreportParameterExpression>
+													</xsl:otherwise>
+												</xsl:choose>
+											</subreportParameter>
+										</xsl:for-each>
+										<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
+										<!-- sub id <= replace with report name -->
+										<id>
+											<xsl:value-of select="SubreportProperties/Id/@value" />
+										</id>
+										<subreportExpression></subreportExpression>
+									</subreport>
+								</xsl:when>
 							</xsl:choose>
 						</xsl:for-each>
 					</band>
@@ -276,7 +592,7 @@
 							select="round(AreaPair[@type='DetailArea']/Area[@type='Detail']/Section/@height div $positionRate)" /></xsl:attribute>
 						<xsl:for-each
 							select="AreaPair[@type='DetailArea']/Area[@type='Detail']/Section/Element">
-							<xsl:variable name="type" select="@type"></xsl:variable>
+							<xsl:variable name="type" select="@type" />
 							<xsl:choose>
 								<xsl:when test="$type='Box'"></xsl:when>
 								<xsl:when test="$type='Line'"></xsl:when>
@@ -310,7 +626,7 @@
 										<!-- align -->
 										<textElement verticalAlignment="Middle">
 											<xsl:variable name="textAlignment"
-												select="CommonProperties/HorizontalAlign/@value"></xsl:variable>
+												select="CommonProperties/HorizontalAlign/@value" />
 											<!-- horizontal align -->
 											<xsl:if test="$textAlignment">
 												<xsl:attribute name="textAlignment">
@@ -330,7 +646,7 @@
 												</xsl:if>
 												<!-- font style -->
 												<xsl:variable name="fontStyle"
-													select="Element/Element/FontProperties/FontStyle/@value"></xsl:variable>
+													select="Element/Element/FontProperties/FontStyle/@value" />
 												<xsl:choose>
 													<xsl:when test="$fontStyle mod 4 ='1'">
 														<xsl:attribute name="isBold">true</xsl:attribute>
@@ -362,7 +678,8 @@
 								<xsl:when test="$type='FieldElement'">
 									<textField isStretchWithOverflow="true"
 										isBlankWhenNull="true">
-										<reportElement stretchType="RelativeToTallestObject" mode="Opaque">
+										<reportElement stretchType="RelativeToTallestObject"
+											mode="Opaque">
 											<!-- position -->
 											<xsl:attribute name="x">
 												<xsl:value-of select="round(@x_position div $positionRate)" />
@@ -389,7 +706,7 @@
 										<!-- align -->
 										<textElement verticalAlignment="Middle">
 											<xsl:variable name="textAlignment"
-												select="CommonProperties/HorizontalAlign/@value"></xsl:variable>
+												select="CommonProperties/HorizontalAlign/@value" />
 											<!-- horizontal align -->
 											<xsl:if test="$textAlignment">
 												<xsl:attribute name="textAlignment">
@@ -409,7 +726,7 @@
 												</xsl:if>
 												<!-- font style -->
 												<xsl:variable name="fontStyle"
-													select="FontProperties/FontStyle/@value"></xsl:variable>
+													select="FontProperties/FontStyle/@value" />
 												<xsl:choose>
 													<xsl:when test="$fontStyle mod 4 ='1'">
 														<xsl:attribute name="isBold">true</xsl:attribute>
@@ -434,28 +751,80 @@
 										</textElement>
 										<!-- textFieldExpression -->
 										<xsl:if test="Reference">
-											<xsl:variable name="type" select="Reference/@type"></xsl:variable>
-											<xsl:variable name="value" select="Reference/@value"></xsl:variable>
+											<xsl:variable name="type" select="Reference/@type" />
+											<xsl:variable name="value" select="Reference/@value" />
 											<textFieldExpression>
 												<xsl:choose>
 													<xsl:when test="$type='DatabaseField'">
 														<xsl:value-of
-															select="concat('$F{',substring-after($value,'.'),'}')"></xsl:value-of>
+															select="concat('$F{',substring-after($value,'.'),'}')" />
 													</xsl:when>
 													<xsl:when test="$type='FormulaField'">
-														<xsl:value-of select="concat('@FormulaField ',$value)"></xsl:value-of>
+														<xsl:value-of select="concat('@FormulaField ',$value)" />
 													</xsl:when>
 													<xsl:when test="$type='SpecialVarField'">
-														<xsl:value-of select="concat('@SpecialVarField ',$value)"></xsl:value-of>
+														<xsl:value-of select="concat('@SpecialVarField ',$value)" />
 													</xsl:when>
 													<xsl:otherwise>
-														<xsl:value-of select="concat('@Unknown ',$value)"></xsl:value-of>
+														<xsl:value-of select="concat('@Unknown ',$value)" />
 													</xsl:otherwise>
 												</xsl:choose>
 											</textFieldExpression>
 										</xsl:if>
 									</textField>
 								</xsl:when>
+								<!-- subreport -->
+								<xsl:when test="$type='Subreport'">
+									<subreport>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- subreportParameter -->
+										<xsl:for-each select="SubreportLinks/SubreportLink">
+											<subreportParameter>
+												<xsl:variable name="type" select="Reference/@type" />
+												<xsl:variable name="value" select="Reference/@value" />
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:attribute name="name">
+															<xsl:value-of select="substring-after($value,'.')" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of
+																select="concat('$F{',substring-after($value,'.'),'}')" />
+														</subreportParameterExpression>
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:attribute name="name">
+															<xsl:value-of select="$value" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of select="concat('@Unknown ',$value)" />
+														</subreportParameterExpression>
+													</xsl:otherwise>
+												</xsl:choose>
+											</subreportParameter>
+										</xsl:for-each>
+										<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
+										<!-- sub id <= replace with report name -->
+										<id>
+											<xsl:value-of select="SubreportProperties/Id/@value" />
+										</id>
+										<subreportExpression></subreportExpression>
+									</subreport>
+								</xsl:when>
 							</xsl:choose>
 						</xsl:for-each>
 					</band>
@@ -468,18 +837,488 @@
 					<band splitType="Prevent">
 						<xsl:attribute name="height"><xsl:value-of
 							select="round(AreaPair[@type='PageAreaPair']/Area[@type='PageFooter']/Section/@height div $positionRate)" /></xsl:attribute>
+						<xsl:for-each
+							select="AreaPair[@type='PageAreaPair']/Area[@type='PageFooter']/Section/Element">
+							<xsl:variable name="type" select="@type" />
+							<xsl:choose>
+								<xsl:when test="$type='Box'"></xsl:when>
+								<xsl:when test="$type='Line'"></xsl:when>
+								<!-- staticText -->
+								<xsl:when test="$type='Text'">
+									<staticText>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- border -->
+										<box topPadding="2" leftPadding="2" bottomPadding="2"
+											rightPadding="2">
+											<pen lineWidth="0.2" />
+											<topPen lineWidth="0.2" />
+											<leftPen lineWidth="0.2" />
+											<bottomPen lineWidth="0.2" />
+											<rightPen lineWidth="0.2" />
+										</box>
+										<!-- align -->
+										<textElement verticalAlignment="Middle">
+											<xsl:variable name="textAlignment"
+												select="CommonProperties/HorizontalAlign/@value" />
+											<!-- horizontal align -->
+											<xsl:if test="$textAlignment">
+												<xsl:attribute name="textAlignment">
+													<xsl:choose>
+														<xsl:when test="$textAlignment='1'">Left</xsl:when>
+														<xsl:when test="$textAlignment='2'">Center</xsl:when>
+														<xsl:when test="$textAlignment='3'">Right</xsl:when>
+													</xsl:choose>
+												</xsl:attribute>
+											</xsl:if>
+											<!-- font -->
+											<font fontName="Microsoft YaHei UI">
+												<!-- font size -->
+												<xsl:if test="FontProperties/FontSize">
+													<xsl:attribute name="size"><xsl:value-of
+														select="round(Element/Element/FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
+												</xsl:if>
+												<!-- font style -->
+												<xsl:variable name="fontStyle"
+													select="Element/Element/FontProperties/FontStyle/@value" />
+												<xsl:choose>
+													<xsl:when test="$fontStyle mod 4 ='1'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='2'">
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='3'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+												</xsl:choose>
+												<!-- font underline -->
+												<xsl:if test="Element/Element/FontProperties/Underline/@value">
+													<xsl:attribute name="isUnderline">true</xsl:attribute>
+												</xsl:if>
+												<!-- font strikethrough -->
+												<xsl:if test="Element/Element/FontProperties/Strikeout/@value">
+													<xsl:attribute name="isStrikeThrough">true</xsl:attribute>
+												</xsl:if>
+											</font>
+										</textElement>
+										<text>
+											<xsl:value-of select="Element/Element/TextData" />
+										</text>
+									</staticText>
+								</xsl:when>
+								<!-- textField -->
+								<xsl:when test="$type='FieldElement'">
+									<textField isBlankWhenNull="true">
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- border -->
+										<box topPadding="2" leftPadding="2" bottomPadding="2"
+											rightPadding="2">
+											<pen lineWidth="0.2" />
+											<topPen lineWidth="0.2" />
+											<leftPen lineWidth="0.2" />
+											<bottomPen lineWidth="0.2" />
+											<rightPen lineWidth="0.2" />
+										</box>
+										<!-- align -->
+										<textElement verticalAlignment="Middle">
+											<xsl:variable name="textAlignment"
+												select="CommonProperties/HorizontalAlign/@value" />
+											<!-- horizontal align -->
+											<xsl:if test="$textAlignment">
+												<xsl:attribute name="textAlignment">
+													<xsl:choose>
+														<xsl:when test="$textAlignment='1'">Left</xsl:when>
+														<xsl:when test="$textAlignment='2'">Center</xsl:when>
+														<xsl:when test="$textAlignment='3'">Right</xsl:when>
+													</xsl:choose>
+												</xsl:attribute>
+											</xsl:if>
+											<!-- font -->
+											<font fontName="Microsoft YaHei UI">
+												<!-- font size -->
+												<xsl:if test="FontProperties/FontSize">
+													<xsl:attribute name="size"><xsl:value-of
+														select="round(FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
+												</xsl:if>
+												<!-- font style -->
+												<xsl:variable name="fontStyle"
+													select="FontProperties/FontStyle/@value" />
+												<xsl:choose>
+													<xsl:when test="$fontStyle mod 4 ='1'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='2'">
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='3'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+												</xsl:choose>
+												<!-- font underline -->
+												<xsl:if test="FontProperties/Underline/@value">
+													<xsl:attribute name="isUnderline">true</xsl:attribute>
+												</xsl:if>
+												<!-- font strikethrough -->
+												<xsl:if test="FontProperties/Strikeout/@value">
+													<xsl:attribute name="isStrikeThrough">true</xsl:attribute>
+												</xsl:if>
+											</font>
+										</textElement>
+										<!-- textFieldExpression -->
+										<xsl:if test="Reference">
+											<xsl:variable name="type" select="Reference/@type" />
+											<xsl:variable name="value" select="Reference/@value" />
+											<textFieldExpression>
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:value-of
+															select="concat('$F{',substring-after($value,'.'),'}')" />
+													</xsl:when>
+													<xsl:when test="$type='FormulaField'">
+														<xsl:value-of select="concat('@FormulaField ',$value)" />
+													</xsl:when>
+													<xsl:when test="$type='SpecialVarField'">
+														<xsl:value-of select="concat('@SpecialVarField ',$value)" />
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:value-of select="concat('@Unknown ',$value)" />
+													</xsl:otherwise>
+												</xsl:choose>
+											</textFieldExpression>
+										</xsl:if>
+									</textField>
+								</xsl:when>
+								<!-- subreport -->
+								<xsl:when test="$type='Subreport'">
+									<subreport>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- subreportParameter -->
+										<xsl:for-each select="SubreportLinks/SubreportLink">
+											<subreportParameter>
+												<xsl:variable name="type" select="Reference/@type" />
+												<xsl:variable name="value" select="Reference/@value" />
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:attribute name="name">
+															<xsl:value-of select="substring-after($value,'.')" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of
+																select="concat('$F{',substring-after($value,'.'),'}')" />
+														</subreportParameterExpression>
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:attribute name="name">
+															<xsl:value-of select="$value" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of select="concat('@Unknown ',$value)" />
+														</subreportParameterExpression>
+													</xsl:otherwise>
+												</xsl:choose>
+											</subreportParameter>
+										</xsl:for-each>
+										<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
+										<!-- sub id <= replace with report name -->
+										<id>
+											<xsl:value-of select="SubreportProperties/Id/@value" />
+										</id>
+										<subreportExpression></subreportExpression>
+									</subreport>
+								</xsl:when>
+							</xsl:choose>
+						</xsl:for-each>
+					</band>
+				</pageFooter>
+			</xsl:if>
+
+			<!-- lastPageFooter -->
+			<xsl:if test="AreaPair[@type='ReportAreaPair']/Area[@type='ReportFooter']">
+				<lastPageFooter>
+					<band splitType="Prevent">
+						<xsl:attribute name="height"><xsl:value-of
+							select="round(AreaPair[@type='ReportAreaPair']/Area[@type='ReportFooter']/Section/@height div $positionRate)" /></xsl:attribute>
+						<xsl:for-each
+							select="AreaPair[@type='ReportAreaPair']/Area[@type='ReportFooter']/Section/Element">
+							<xsl:variable name="type" select="@type" />
+							<xsl:choose>
+								<xsl:when test="$type='Box'"></xsl:when>
+								<xsl:when test="$type='Line'"></xsl:when>
+								<!-- staticText -->
+								<xsl:when test="$type='Text'">
+									<staticText>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- border -->
+										<box topPadding="2" leftPadding="2" bottomPadding="2"
+											rightPadding="2">
+											<pen lineWidth="0.2" />
+											<topPen lineWidth="0.2" />
+											<leftPen lineWidth="0.2" />
+											<bottomPen lineWidth="0.2" />
+											<rightPen lineWidth="0.2" />
+										</box>
+										<!-- align -->
+										<textElement verticalAlignment="Middle">
+											<xsl:variable name="textAlignment"
+												select="CommonProperties/HorizontalAlign/@value" />
+											<!-- horizontal align -->
+											<xsl:if test="$textAlignment">
+												<xsl:attribute name="textAlignment">
+													<xsl:choose>
+														<xsl:when test="$textAlignment='1'">Left</xsl:when>
+														<xsl:when test="$textAlignment='2'">Center</xsl:when>
+														<xsl:when test="$textAlignment='3'">Right</xsl:when>
+													</xsl:choose>
+												</xsl:attribute>
+											</xsl:if>
+											<!-- font -->
+											<font fontName="Microsoft YaHei UI">
+												<!-- font size -->
+												<xsl:if test="FontProperties/FontSize">
+													<xsl:attribute name="size"><xsl:value-of
+														select="round(Element/Element/FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
+												</xsl:if>
+												<!-- font style -->
+												<xsl:variable name="fontStyle"
+													select="Element/Element/FontProperties/FontStyle/@value" />
+												<xsl:choose>
+													<xsl:when test="$fontStyle mod 4 ='1'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='2'">
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='3'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+												</xsl:choose>
+												<!-- font underline -->
+												<xsl:if test="Element/Element/FontProperties/Underline/@value">
+													<xsl:attribute name="isUnderline">true</xsl:attribute>
+												</xsl:if>
+												<!-- font strikethrough -->
+												<xsl:if test="Element/Element/FontProperties/Strikeout/@value">
+													<xsl:attribute name="isStrikeThrough">true</xsl:attribute>
+												</xsl:if>
+											</font>
+										</textElement>
+										<text>
+											<xsl:value-of select="Element/Element/TextData" />
+										</text>
+									</staticText>
+								</xsl:when>
+								<!-- textField -->
+								<xsl:when test="$type='FieldElement'">
+									<textField isBlankWhenNull="true">
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- border -->
+										<box topPadding="2" leftPadding="2" bottomPadding="2"
+											rightPadding="2">
+											<pen lineWidth="0.2" />
+											<topPen lineWidth="0.2" />
+											<leftPen lineWidth="0.2" />
+											<bottomPen lineWidth="0.2" />
+											<rightPen lineWidth="0.2" />
+										</box>
+										<!-- align -->
+										<textElement verticalAlignment="Middle">
+											<xsl:variable name="textAlignment"
+												select="CommonProperties/HorizontalAlign/@value" />
+											<!-- horizontal align -->
+											<xsl:if test="$textAlignment">
+												<xsl:attribute name="textAlignment">
+													<xsl:choose>
+														<xsl:when test="$textAlignment='1'">Left</xsl:when>
+														<xsl:when test="$textAlignment='2'">Center</xsl:when>
+														<xsl:when test="$textAlignment='3'">Right</xsl:when>
+													</xsl:choose>
+												</xsl:attribute>
+											</xsl:if>
+											<!-- font -->
+											<font fontName="Microsoft YaHei UI">
+												<!-- font size -->
+												<xsl:if test="FontProperties/FontSize">
+													<xsl:attribute name="size"><xsl:value-of
+														select="round(FontProperties/FontSize/@value div $positionRate * 0.75)" /></xsl:attribute>
+												</xsl:if>
+												<!-- font style -->
+												<xsl:variable name="fontStyle"
+													select="FontProperties/FontStyle/@value" />
+												<xsl:choose>
+													<xsl:when test="$fontStyle mod 4 ='1'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='2'">
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+													<xsl:when test="$fontStyle mod 4 ='3'">
+														<xsl:attribute name="isBold">true</xsl:attribute>
+														<xsl:attribute name="isItalic">true</xsl:attribute>
+													</xsl:when>
+												</xsl:choose>
+												<!-- font underline -->
+												<xsl:if test="FontProperties/Underline/@value">
+													<xsl:attribute name="isUnderline">true</xsl:attribute>
+												</xsl:if>
+												<!-- font strikethrough -->
+												<xsl:if test="FontProperties/Strikeout/@value">
+													<xsl:attribute name="isStrikeThrough">true</xsl:attribute>
+												</xsl:if>
+											</font>
+										</textElement>
+										<!-- textFieldExpression -->
+										<xsl:if test="Reference">
+											<xsl:variable name="type" select="Reference/@type" />
+											<xsl:variable name="value" select="Reference/@value" />
+											<textFieldExpression>
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:value-of
+															select="concat('$F{',substring-after($value,'.'),'}')" />
+													</xsl:when>
+													<xsl:when test="$type='FormulaField'">
+														<xsl:value-of select="concat('@FormulaField ',$value)" />
+													</xsl:when>
+													<xsl:when test="$type='SpecialVarField'">
+														<xsl:value-of select="concat('@SpecialVarField ',$value)" />
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:value-of select="concat('@Unknown ',$value)" />
+													</xsl:otherwise>
+												</xsl:choose>
+											</textFieldExpression>
+										</xsl:if>
+									</textField>
+								</xsl:when>
+								<!-- subreport -->
+								<xsl:when test="$type='Subreport'">
+									<subreport>
+										<reportElement mode="Opaque">
+											<!-- position -->
+											<xsl:attribute name="x">
+												<xsl:value-of select="round(@x_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="y">
+												<xsl:value-of select="round(@y_position div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="width">
+												<xsl:value-of select="round(@width div $positionRate)" />
+											</xsl:attribute>
+											<xsl:attribute name="height">
+												<xsl:value-of select="round(@height div $positionRate * 1.2)" />
+											</xsl:attribute>
+										</reportElement>
+										<!-- subreportParameter -->
+										<xsl:for-each select="SubreportLinks/SubreportLink">
+											<subreportParameter>
+												<xsl:variable name="type" select="Reference/@type" />
+												<xsl:variable name="value" select="Reference/@value" />
+												<xsl:choose>
+													<xsl:when test="$type='DatabaseField'">
+														<xsl:attribute name="name">
+															<xsl:value-of select="substring-after($value,'.')" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of
+																select="concat('$F{',substring-after($value,'.'),'}')" />
+														</subreportParameterExpression>
+													</xsl:when>
+													<xsl:otherwise>
+														<xsl:attribute name="name">
+															<xsl:value-of select="$value" />
+														</xsl:attribute>
+														<subreportParameterExpression>
+															<xsl:value-of select="concat('@Unknown ',$value)" />
+														</subreportParameterExpression>
+													</xsl:otherwise>
+												</xsl:choose>
+											</subreportParameter>
+										</xsl:for-each>
+										<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
+										<!-- sub id <= replace with report name -->
+										<id>
+											<xsl:value-of select="SubreportProperties/Id/@value" />
+										</id>
+										<subreportExpression></subreportExpression>
+									</subreport>
+								</xsl:when>
+							</xsl:choose>
+						</xsl:for-each>
 					</band>
-				</pageFooter>
-			</xsl:if>
-
-			<!-- summary -->
-			<xsl:if test="AreaPair[@type='ReportAreaPair']/Area[@type='ReportFooter']">
-				<summary>
-					<band splitType="Prevent">
-						<xsl:attribute name="height"><xsl:value-of
-							select="round(AreaPair[@type='ReportAreaPair']/Area[@type='ReportFooter']/Section/@height div $positionRate)" /></xsl:attribute>
-					</band>
-				</summary>
+				</lastPageFooter>
 			</xsl:if>
 		</jasperReport>
 	</xsl:template>