Merge pull request #822 from MrDevKing/feature_validation_pdf_wrapping_msg_txt

Wrapping Message Text in Validation Result PDF
This commit is contained in:
Jochen Staerk
2025-05-26 11:18:12 +02:00
committed by GitHub

View File

@@ -276,7 +276,9 @@
<fo:block color="{$msg_color}"
margin="0mm"
padding="1mm">
<xsl:value-of select="$msg_text"/>
<xsl:call-template name="IntersperseWithZeroSpaces">
<xsl:with-param name="str" select="$msg_text"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
@@ -349,4 +351,27 @@
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template name="IntersperseWithZeroSpaces">
<xsl:param name="str"/>
<xsl:variable name="spacechars">
&#x9;&#xA;
&#x2000;&#x2001;&#x2002;&#x2003;&#x2004;&#x2005;
&#x2006;&#x2007;&#x2008;&#x2009;&#x200A;&#x200B;
</xsl:variable>
<xsl:if test="string-length($str) &gt; 0">
<xsl:variable name="c1" select="substring($str, 1, 1)"/>
<xsl:variable name="c2" select="substring($str, 2, 1)"/>
<xsl:value-of select="$c1"/>
<xsl:if test="$c2 != '' and
not(contains($spacechars, $c1) or
contains($spacechars, $c2))">
<xsl:text>&#x200B;</xsl:text>
</xsl:if>
<xsl:call-template name="IntersperseWithZeroSpaces">
<xsl:with-param name="str" select="substring($str, 2)"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>