|
|
@@ -7,10 +7,7 @@
|
|
|
indent="yes"
|
|
|
cdata-section-elements="parameterDescription defaultValueExpression queryString variableExpression text textFieldExpression imageExpression subreportParameterExpression connectionExpression subreportExpression" />
|
|
|
<!-- position rate from crystal to jasper -->
|
|
|
-
|
|
|
- <xsl:variable name="positionRate">
|
|
|
- 15
|
|
|
- </xsl:variable>
|
|
|
+ <xsl:variable name="positionRate">15</xsl:variable>
|
|
|
|
|
|
<xsl:template match="inet:Report">
|
|
|
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
|
|
|
@@ -56,18 +53,16 @@
|
|
|
<xsl:variable name="name" select="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:call-template name="typeToClass">
|
|
|
+ <xsl:with-param name="type">
|
|
|
+ <xsl:value-of select="@valueType" />
|
|
|
+ </xsl:with-param>
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:attribute>
|
|
|
<!-- default value -->
|
|
|
<defaultValueExpression>
|
|
|
@@ -89,13 +84,11 @@
|
|
|
<xsl:attribute name="name"><xsl:value-of
|
|
|
select="concat($tableName,'.',@name)" /></xsl:attribute>
|
|
|
<xsl:attribute name="class">
|
|
|
- <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>
|
|
|
- <xsl:when test="$type='11'">java.lang.String</xsl:when>
|
|
|
- <xsl:when test="$type='15'">java.sql.Timestamp</xsl:when>
|
|
|
- </xsl:choose>
|
|
|
+ <xsl:call-template name="typeToClass">
|
|
|
+ <xsl:with-param name="type">
|
|
|
+ <xsl:value-of select="@type" />
|
|
|
+ </xsl:with-param>
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:attribute>
|
|
|
</field>
|
|
|
</xsl:for-each>
|
|
|
@@ -151,8 +144,9 @@
|
|
|
<band>
|
|
|
<xsl:attribute name="height"><xsl:value-of
|
|
|
select="round(sum(Area[@type='GroupHeader']/Section/@height) div $positionRate)" /></xsl:attribute>
|
|
|
- <xsl:for-each select="Area[@type='GroupHeader']/Section">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ <xsl:for-each select="Area[@type='GroupHeader']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</groupHeader>
|
|
|
@@ -160,8 +154,9 @@
|
|
|
<band>
|
|
|
<xsl:attribute name="height"><xsl:value-of
|
|
|
select="round(sum(Area[@type='GroupFooter']/Section/@height) div $positionRate)" /></xsl:attribute>
|
|
|
- <xsl:for-each select="Area[@type='GroupFooter']/Section">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ <xsl:for-each select="Area[@type='GroupFooter']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</groupFooter>
|
|
|
@@ -175,8 +170,9 @@
|
|
|
<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">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ select="AreaPair[@type='ReportAreaPair']/Area[@type='ReportHeader']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</title>
|
|
|
@@ -188,8 +184,9 @@
|
|
|
<xsl:attribute name="height"><xsl:value-of
|
|
|
select="round(sum(AreaPair[@type='PageAreaPair']/Area[@type='PageHeader']/Section/@height) div $positionRate)" /></xsl:attribute>
|
|
|
<xsl:for-each
|
|
|
- select="AreaPair[@type='PageAreaPair']/Area[@type='PageHeader']/Section">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ select="AreaPair[@type='PageAreaPair']/Area[@type='PageHeader']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</pageHeader>
|
|
|
@@ -201,8 +198,9 @@
|
|
|
<xsl:attribute name="height"><xsl:value-of
|
|
|
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">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ select="AreaPair[@type='DetailArea']/Area[@type='Detail']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</detail>
|
|
|
@@ -215,8 +213,9 @@
|
|
|
<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">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ select="AreaPair[@type='PageAreaPair']/Area[@type='PageFooter']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</pageFooter>
|
|
|
@@ -229,8 +228,9 @@
|
|
|
<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">
|
|
|
- <xsl:apply-templates select="Element" />
|
|
|
+ select="AreaPair[@type='ReportAreaPair']/Area[@type='ReportFooter']/Section/Element">
|
|
|
+ <xsl:call-template name="element">
|
|
|
+ </xsl:call-template>
|
|
|
</xsl:for-each>
|
|
|
</band>
|
|
|
</lastPageFooter>
|
|
|
@@ -238,7 +238,8 @@
|
|
|
</jasperReport>
|
|
|
</xsl:template>
|
|
|
|
|
|
- <xsl:template match="Element">
|
|
|
+ <!-- process element -->
|
|
|
+ <xsl:template name="element">
|
|
|
<xsl:variable name="type" select="@type" />
|
|
|
<xsl:choose>
|
|
|
<xsl:when test="$type='Box'"></xsl:when>
|
|
|
@@ -248,18 +249,9 @@
|
|
|
<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.25)" />
|
|
|
- </xsl:attribute>
|
|
|
+ <xsl:call-template name="position" >
|
|
|
+ <xsl:with-param name="heightFactor">1.25</xsl:with-param>
|
|
|
+ </xsl:call-template>
|
|
|
<!-- color -->
|
|
|
<xsl:variable name="foreColor"
|
|
|
select="Element/Element/FontProperties/FontColor/@value" />
|
|
|
@@ -279,14 +271,7 @@
|
|
|
</xsl:if>
|
|
|
</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>
|
|
|
+ <xsl:call-template name="border" />
|
|
|
<!-- align -->
|
|
|
<textElement verticalAlignment="Middle">
|
|
|
<xsl:variable name="textAlignment"
|
|
|
@@ -344,21 +329,12 @@
|
|
|
<reportElement stretchType="RelativeToTallestObject"
|
|
|
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.25)" />
|
|
|
- </xsl:attribute>
|
|
|
+ <xsl:call-template name="position" >
|
|
|
+ <xsl:with-param name="heightFactor">1.25</xsl:with-param>
|
|
|
+ </xsl:call-template>
|
|
|
<!-- color -->
|
|
|
<xsl:variable name="foreColor"
|
|
|
- select="Element/Element/FontProperties/FontColor/@value" />
|
|
|
+ select="FontProperties/FontColor/@value" />
|
|
|
<xsl:variable name="backColor"
|
|
|
select="BorderProperties/BackgroundColor/@value" />
|
|
|
<xsl:if test="$foreColor">
|
|
|
@@ -375,18 +351,11 @@
|
|
|
</xsl:if>
|
|
|
</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>
|
|
|
+ <xsl:call-template name="border" />
|
|
|
<!-- align -->
|
|
|
<textElement verticalAlignment="Middle">
|
|
|
<xsl:variable name="textAlignment"
|
|
|
- select="Element/CommonProperties/HorizontalAlign/@value" />
|
|
|
+ select="CommonProperties/HorizontalAlign/@value" />
|
|
|
<!-- horizontal align -->
|
|
|
<xsl:if test="$textAlignment">
|
|
|
<xsl:attribute name="textAlignment">
|
|
|
@@ -459,18 +428,9 @@
|
|
|
<image>
|
|
|
<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)" />
|
|
|
- </xsl:attribute>
|
|
|
+ <xsl:call-template name="position">
|
|
|
+ <xsl:with-param name="heightFactor">1</xsl:with-param>
|
|
|
+ </xsl:call-template>
|
|
|
</reportElement>
|
|
|
<imageExpression>
|
|
|
<xsl:variable name="quot">'</xsl:variable>
|
|
|
@@ -484,18 +444,9 @@
|
|
|
<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)" />
|
|
|
- </xsl:attribute>
|
|
|
+ <xsl:call-template name="position">
|
|
|
+ <xsl:with-param name="heightFactor">1</xsl:with-param>
|
|
|
+ </xsl:call-template>
|
|
|
</reportElement>
|
|
|
<!-- subreportParameter -->
|
|
|
<xsl:for-each select="SubreportLinks/SubreportLink">
|
|
|
@@ -522,9 +473,7 @@
|
|
|
</xsl:choose>
|
|
|
</subreportParameter>
|
|
|
</xsl:for-each>
|
|
|
- <connectionExpression>
|
|
|
- <![CDATA[$P{REPORT_CONNECTION}]]>
|
|
|
- </connectionExpression>
|
|
|
+ <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
|
|
|
<!-- sub id <= replace with report name -->
|
|
|
<id>
|
|
|
<xsl:value-of select="SubreportProperties/Id/@value" />
|
|
|
@@ -534,4 +483,44 @@
|
|
|
</xsl:when>
|
|
|
</xsl:choose>
|
|
|
</xsl:template>
|
|
|
+
|
|
|
+ <!-- position -->
|
|
|
+ <xsl:template name="position">
|
|
|
+ <xsl:param name="heightFactor" />
|
|
|
+ <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 * $heightFactor)" />
|
|
|
+ </xsl:attribute>
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
+ <!-- border -->
|
|
|
+ <xsl:template name="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>
|
|
|
+ </xsl:template>
|
|
|
+
|
|
|
+ <!-- type of crystal to class of jasper -->
|
|
|
+ <xsl:template name="typeToClass">
|
|
|
+ <xsl:param name="type" />
|
|
|
+ <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:template>
|
|
|
</xsl:stylesheet>
|