繁体   English   中英

为什么“ xsl:if test”在Barcode4j插件上不起作用

[英]Why “xsl:if test” don't work on Barcode4j plugin

大家下午好! 我在测试条形码的值时遇到问题。 首先,我将向您展示xsl和xml代码,然后我将解释问题。 Xsl代码:

<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源代码:

<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>

条形码值为空。 在测试方面, <xsl:if test="gsmsg/barcode">必须验证是否存在值,否则,fop不要读取Barcode4j插件。 在我的情况下, <xsl:if test="gsmsg/barcode">不起作用,因为继续读取Barcode4j插件并且由于条形码的“ message”参数而导致打印崩溃不能为空。 为什么xsl:if在我的情况下不起作用? 请帮我,

最好的问候,Marco

从理论上讲

<xsl:if test="gsmsg/barcode">

测试barcode元素的存在。

如果要测试是否存在文本值,请执行以下操作:

<xsl:if test="string(gsmsg/barcode)">

要么:

<xsl:if test="gsmsg/barcode/text()">

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM