[英]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.