Good afternoon at all members! I have a problem with testing the value of barcode. First, I'll show you the xsl and the xml code, then I'll explain the trouble. Xsl code:
<fo:table-cell font-size="7" padding="0.5mm" border-width="0.2mm" border-style="transparent">
<fo:block>
<xsl:if test="gsmsg/barcode">
<fo:block>
<fo:instream-foreign-object>
<xsl:variable name="Barcod">
<xsl:value-of select="gsmsg/barcode"/>
</xsl:variable>
<barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns"
message="{$Barcod}" orientation="0">
<barcode:code128>
<barcode:height>8mm</barcode:height>
</barcode:code128>
</barcode:barcode>
</fo:instream-foreign-object>
</fo:block>
</xsl:if>
</fo:block>
</fo:table-cell>
Xml source code:
<gsmsg xmlns="">
<IdentificativoSdI>169077607</IdentificativoSdI>
<NomeFile>IT01942890995.xml</NomeFile>
<Formato>FPR12</Formato>
<MessageId>1185389295</MessageId>
<TentativiInvio>1</TentativiInvio>
<Lotto>405</Lotto>
<attpass>P</attpass>
<Versione>0.7</Versione>
<TipoMsg>DO</TipoMsg>
<barcode/>
<note/>
</gsmsg>
Value of barcode is empty. In terms of teory <xsl:if test="gsmsg/barcode"> must verify if there's a value, and if not , fop don't read the Barcode4j plugin.
In my case, <xsl:if test="gsmsg/barcode"> doesen't work, because continue to read the Barcode4j plugin and the print crashes due to barcode's "message" parameter cannot be empty.
Why xsl:if doesen't work in my
case?
Please help me,
Best regards, Marco
In terms of theory,
tests for the existence of the
barcodeelement.If you want to test for the existence of a text value, do:
or: