Merge pull request #645 from Adrian-Devries/FixVisualizationOfValidationLog
Fix visualization of validation logs
This commit is contained in:
@@ -1,135 +1,135 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
<xsl:stylesheet xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
|
||||||
|
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||||
|
xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"
|
||||||
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions"
|
version="2.0">
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
<!-- Imports -->
|
||||||
version="2.0">
|
|
||||||
<!-- ==========================================================================
|
|
||||||
== Imports
|
|
||||||
=========================================================================== -->
|
|
||||||
<xsl:import href="common-xr.xsl"/>
|
<xsl:import href="common-xr.xsl"/>
|
||||||
|
|
||||||
<xsl:import href="xr-pdf/lib/konstanten.xsl"/>
|
<xsl:import href="xr-pdf/lib/konstanten.xsl"/>
|
||||||
|
<!--
|
||||||
<!-- FO engine used can be specified. Specific extensions will be then enabled.
|
FO engine used can be specified.
|
||||||
Supported values are:
|
Specific extensions will be then enabled.
|
||||||
axf - Antenna House XSL Formatter
|
Supported values are:
|
||||||
fop - Apache FOP
|
axf - Antenna House XSL Formatter
|
||||||
-->
|
fop - Apache FOP
|
||||||
|
-->
|
||||||
<xsl:param name="foengine"/>
|
<xsl:param name="foengine"/>
|
||||||
|
<xsl:param name="axf.extensions"
|
||||||
<xsl:param name="axf.extensions" select="if ($foengine eq 'axf') then true() else false()"/>
|
select="if ($foengine eq 'axf') then true() else false()"/>
|
||||||
<xsl:param name="fop.extensions" select="if ($foengine eq 'fop') then true() else false()"/>
|
<xsl:param name="fop.extensions"
|
||||||
|
select="if ($foengine eq 'fop') then true() else false()"/>
|
||||||
|
|
||||||
<xsl:variable name="xml_result_color">
|
<xsl:variable name="xml_result_color">
|
||||||
<xsl:if test="/validation/xml/summary/@status = 'valid' ">
|
<xsl:if test="/validation/xml/summary/@status = 'valid'">
|
||||||
<xsl:text>green</xsl:text>
|
<xsl:text>green</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="/validation/xml/summary/@status = 'invalid' ">
|
<xsl:if test="/validation/xml/summary/@status = 'invalid'">
|
||||||
<xsl:text>red</xsl:text>
|
<xsl:text>red</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:variable name="pdf_result_color">
|
<xsl:variable name="pdf_result_color">
|
||||||
<xsl:if test="/validation/pdf/summary/@status = 'valid' ">
|
<xsl:if test="/validation/pdf/summary/@status = 'valid'">
|
||||||
<xsl:text>green</xsl:text>
|
<xsl:text>green</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="/validation/pdf/summary/@status = 'invalid' ">
|
<xsl:if test="/validation/pdf/summary/@status = 'invalid'">
|
||||||
<xsl:text>red</xsl:text>
|
<xsl:text>red</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:variable name="pdf_result_text">
|
<xsl:variable name="pdf_result_text">
|
||||||
<xsl:if test="/validation/xml/summary/@status = 'valid' ">
|
<xsl:if test="/validation/xml/summary/@status = 'valid'">
|
||||||
<xsl:text>Das ZUGFeRD-PDF ist valide.</xsl:text>
|
<xsl:text>Das ZUGFeRD-PDF ist valide.</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="/validation/xml/summary/@status = 'invalid' ">
|
<xsl:if test="/validation/xml/summary/@status = 'invalid'">
|
||||||
<xsl:text>Das ZUGFeRD-PDF ist nicht valide.</xsl:text>
|
<xsl:text>Das ZUGFeRD-PDF ist nicht valide.</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:variable name="result_text">
|
<xsl:variable name="result_text">
|
||||||
<xsl:if test="/validation/xml/summary/@status = 'valid' ">
|
<xsl:if test="/validation/xml/summary/@status = 'valid'">
|
||||||
<xsl:text>Es wird empfohlen das Dokument anzunehmen und weiter zu verarbeiten.</xsl:text>
|
<xsl:text>Es wird empfohlen, das Dokument anzunehmen und weiterzuverarbeiten.</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:if test="/validation/xml/summary/@status = 'invalid' ">
|
<xsl:if test="/validation/xml/summary/@status = 'invalid'">
|
||||||
<xsl:text>Es wird empfohlen das Dokument zurückzuweisen.</xsl:text>
|
<xsl:text>Es wird empfohlen, das Dokument zurückzuweisen.</xsl:text>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
|
|
||||||
<xsl:template match="validation">
|
<xsl:template match="validation">
|
||||||
<fo:root xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"
|
<fo:root language="{$lang}"
|
||||||
language="{$lang}" font-family="{$fontSans}">
|
font-family="{$fontSans}">
|
||||||
<fo:layout-master-set>
|
<fo:layout-master-set>
|
||||||
<fo:simple-page-master master-name="DIN-A4" page-height="297mm" page-width="210mm">
|
<fo:simple-page-master master-name="DIN-A4"
|
||||||
<fo:region-body region-name="body" margin="20mm 10mm 20mm 20mm" />
|
page-height="297mm"
|
||||||
|
page-width="210mm">
|
||||||
|
<fo:region-body region-name="body"
|
||||||
|
margin="20mm 10mm 20mm 20mm"/>
|
||||||
</fo:simple-page-master>
|
</fo:simple-page-master>
|
||||||
</fo:layout-master-set>
|
</fo:layout-master-set>
|
||||||
|
|
||||||
<fo:page-sequence master-reference="DIN-A4">
|
<fo:page-sequence master-reference="DIN-A4">
|
||||||
<fo:flow flow-name="body">
|
<fo:flow flow-name="body">
|
||||||
<fo:block font-size="24px" font-weight="bold">
|
<fo:block font-size="24px"
|
||||||
Prüfbericht
|
font-weight="bold">
|
||||||
|
<xsl:text>Prüfbericht</xsl:text>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
|
|
||||||
<xsl:call-template name="SubHeader">
|
<xsl:call-template name="SubHeader">
|
||||||
<xsl:with-param name="text" select='"Angaben zum geprüften Dokument"' />
|
<xsl:with-param name="text"
|
||||||
<xsl:with-param name="color" select='"black"' />
|
select=""Angaben zum geprüften Dokument""/>
|
||||||
|
<xsl:with-param name="color"
|
||||||
|
select=""black""/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
|
||||||
<fo:block>
|
<fo:block>
|
||||||
<fo:block text-align="justify">
|
<fo:block text-align="justify">
|
||||||
<fo:float float="right">
|
<fo:float float="right">
|
||||||
<fo:block >
|
<fo:block>
|
||||||
<xsl:value-of select="/validation/@filename" />
|
<xsl:value-of select="/validation/@filename"/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:float>
|
</fo:float>
|
||||||
Referenz:
|
<xsl:text>Referenz:</xsl:text>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
<fo:block>
|
<fo:block>
|
||||||
<fo:block text-align="justify">
|
<fo:block text-align="justify">
|
||||||
<fo:float float="right">
|
<fo:float float="right">
|
||||||
<fo:block >
|
<fo:block>
|
||||||
<xsl:value-of select="/validation/@datetime" />
|
<xsl:value-of select="/validation/@datetime"/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:float>
|
</fo:float>
|
||||||
Zeitpunkt der Prüfung:
|
<xsl:text>Zeitpunkt der Prüfung:</xsl:text>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
<fo:block>
|
<fo:block>
|
||||||
<fo:block text-align="justify">
|
<fo:block text-align="justify">
|
||||||
<fo:float float="right">
|
<fo:float float="right">
|
||||||
<fo:block >
|
<fo:block>
|
||||||
<xsl:value-of select="/validation/xml/info/profile" />
|
<xsl:value-of select="/validation/xml/info/profile"/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:float>
|
</fo:float>
|
||||||
Erkannter Dokumenttyp:
|
<xsl:text>Erkannter Dokumenttyp:</xsl:text>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
|
<xsl:apply-templates select="/validation/pdf"/>
|
||||||
<xsl:apply-templates select="/validation/pdf" />
|
<!--
|
||||||
|
<xsl:call-template name="SubHeader">
|
||||||
<!--<xsl:call-template name="SubHeader" >
|
<xsl:with-param name="text"
|
||||||
<xsl:with-param name="text" select='"Konformitätsprüfung:"' />
|
select='"Konformitätsprüfung:"'/>
|
||||||
<xsl:with-param name="color" select='"black"' />
|
<xsl:with-param name="color"
|
||||||
</xsl:call-template>-->
|
select='"black"'/>
|
||||||
|
</xsl:call-template>
|
||||||
<xsl:call-template name="SubHeader" >
|
-->
|
||||||
<xsl:with-param name="text" select="concat('Bewertung: ', $result_text)" />
|
<xsl:call-template name="SubHeader">
|
||||||
<xsl:with-param name="color" select="$xml_result_color" />
|
<xsl:with-param name="text"
|
||||||
|
select="concat('Bewertung: ', $result_text)"/>
|
||||||
|
<xsl:with-param name="color"
|
||||||
|
select="$xml_result_color"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
|
||||||
<fo:block>Validierungsergebnisse im Detail:</fo:block>
|
<fo:block>Validierungsergebnisse im Detail:</fo:block>
|
||||||
|
|
||||||
<fo:table>
|
<fo:table>
|
||||||
<fo:table-column border-style="solid" />
|
<fo:table-column border-style="solid"/>
|
||||||
<fo:table-column border-style="solid" />
|
<fo:table-column border-style="solid"/>
|
||||||
<fo:table-column border-style="solid" />
|
<fo:table-column border-style="solid"/>
|
||||||
<fo:table-column column-width="70%" border-style="solid" />
|
<fo:table-column column-width="70%"
|
||||||
|
border-style="solid"/>
|
||||||
<fo:table-header>
|
<fo:table-header>
|
||||||
<fo:table-row background-color="#E0E0E0" font-weight="bold">
|
<fo:table-row background-color="#E0E0E0"
|
||||||
|
font-weight="bold">
|
||||||
<fo:table-cell>
|
<fo:table-cell>
|
||||||
<fo:block>Type</fo:block>
|
<fo:block>Type</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
@@ -145,38 +145,50 @@
|
|||||||
</fo:table-row>
|
</fo:table-row>
|
||||||
</fo:table-header>
|
</fo:table-header>
|
||||||
<fo:table-body>
|
<fo:table-body>
|
||||||
<xsl:apply-templates select="/validation/xml/messages" />
|
<xsl:choose>
|
||||||
|
<xsl:when test="/validation/xml/messages">
|
||||||
|
<xsl:apply-templates select="/validation/xml/messages"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<fo:table-row font-size="12px"
|
||||||
|
border-style="solid">
|
||||||
|
<fo:table-cell number-columns-spanned="4">
|
||||||
|
<fo:block text-align="center">Es gibt weder Hinweise noch Fehler.</fo:block>
|
||||||
|
</fo:table-cell>
|
||||||
|
</fo:table-row>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
</fo:table-body>
|
</fo:table-body>
|
||||||
</fo:table>
|
</fo:table>
|
||||||
|
|
||||||
</fo:flow>
|
</fo:flow>
|
||||||
</fo:page-sequence>
|
</fo:page-sequence>
|
||||||
</fo:root>
|
</fo:root>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="notice|error">
|
<xsl:template match="notice|error">
|
||||||
<fo:table-row font-size="12px" border-style="solid">
|
<fo:table-row font-size="12px"
|
||||||
|
border-style="solid">
|
||||||
<fo:table-cell number-rows-spanned="2">
|
<fo:table-cell number-rows-spanned="2">
|
||||||
<fo:block>
|
<fo:block>
|
||||||
<xsl:value-of select="@type" />
|
<xsl:value-of select="@type"/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
<fo:table-cell number-rows-spanned="2">
|
<fo:table-cell number-rows-spanned="2">
|
||||||
<fo:block>
|
<fo:block>
|
||||||
<xsl:call-template name="SUBID" >
|
<xsl:call-template name="SUBID">
|
||||||
<xsl:with-param name="myparam" select="substring-after(.,' [ID ')" />
|
<xsl:with-param name="myparam"
|
||||||
|
select="substring-after(.,' [ID ')"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
<fo:table-cell number-rows-spanned="2">
|
<fo:table-cell number-rows-spanned="2">
|
||||||
<fo:block >
|
<fo:block>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="name() = 'error'">
|
<xsl:when test="name() = 'error'">
|
||||||
<xsl:attribute name="color">red</xsl:attribute>
|
<xsl:attribute name="color">red</xsl:attribute>
|
||||||
Fehler
|
<xsl:text>Fehler</xsl:text>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
Hinweis
|
<xsl:text>Hinweis</xsl:text>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
@@ -186,42 +198,46 @@
|
|||||||
<xsl:if test="name() = 'error'">
|
<xsl:if test="name() = 'error'">
|
||||||
<xsl:attribute name="color">red</xsl:attribute>
|
<xsl:attribute name="color">red</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
<xsl:value-of select="substring-before(.,' [ID')" />
|
<xsl:value-of select="substring-before(.,' [ID')"/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
</fo:table-row>
|
</fo:table-row>
|
||||||
<fo:table-row font-size="12px" border-style="solid">
|
<fo:table-row font-size="10px"
|
||||||
|
border-style="solid">
|
||||||
<fo:table-cell>
|
<fo:table-cell>
|
||||||
<fo:block>
|
<fo:block>
|
||||||
<xsl:if test="name() = 'error'">
|
<xsl:if test="name() = 'error'">
|
||||||
<xsl:attribute name="color">red</xsl:attribute>
|
<xsl:attribute name="color">red</xsl:attribute>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
Pfad:
|
<xsl:value-of select="concat('Pfad: ', @location)"/>
|
||||||
<xsl:value-of select="@location" />
|
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</fo:table-cell>
|
</fo:table-cell>
|
||||||
</fo:table-row>
|
</fo:table-row>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="pdf">
|
<xsl:template match="pdf">
|
||||||
<xsl:call-template name="SubHeader" >
|
<xsl:call-template name="SubHeader">
|
||||||
<xsl:with-param name="text" select="concat('ZUGFeRD-PDF: ', $pdf_result_text)" />
|
<xsl:with-param name="text"
|
||||||
<xsl:with-param name="color" select='"black"' />
|
select="concat('ZUGFeRD-PDF: ', $pdf_result_text)"/>
|
||||||
|
<xsl:with-param name="color"
|
||||||
|
select=""black""/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="SubHeader">
|
<xsl:template name="SubHeader">
|
||||||
<xsl:param name="text" />
|
<xsl:param name="text"/>
|
||||||
<xsl:param name="color" />
|
<xsl:param name="color"/>
|
||||||
<fo:block color="{$color}" background-color="#E0E0E0" margin-bottom="10px" padding="3px" font-weight="bold" margin-top="10px">
|
<fo:block color="{$color}"
|
||||||
<xsl:value-of select="$text" />
|
background-color="#E0E0E0"
|
||||||
|
margin-bottom="10px"
|
||||||
|
padding="3px"
|
||||||
|
font-weight="bold"
|
||||||
|
margin-top="10px">
|
||||||
|
<xsl:value-of select="$text"/>
|
||||||
</fo:block>
|
</fo:block>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template name="SUBID">
|
<xsl:template name="SUBID">
|
||||||
<xsl:param name="myparam" />
|
<xsl:param name="myparam"/>
|
||||||
<xsl:variable name="myparam.end" select="substring-before($myparam, ']')"/>
|
<xsl:variable name="myparam.end"
|
||||||
|
select="substring-before($myparam, ']')"/>
|
||||||
<xsl:value-of select="$myparam.end"/>
|
<xsl:value-of select="$myparam.end"/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|||||||
Reference in New Issue
Block a user