XSLT测试元素的值
我得到了以下xml:XSLT测试元素的值,xslt,Xslt,我得到了以下xml: <company <division> ... <employees> <employee> <company>First supplier</company> <fee>10000.00</fee> <vat
<company
<division>
...
<employees>
<employee>
<company>First supplier</company>
<fee>10000.00</fee>
<vat>yes</vat> <!-- Is the contractor a VAT payer (yes/no) -->
</employee>
</employees>
</division>
</company>
感谢您的回答:)您的
xsl:if
中缺少了一些关于“否”值的引号。我还添加了一个缺少的
标记,并删除了select表达式不必要的/
前缀。试试这个:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/company/division/employees/employee">
<xsl:value-of select="company" />, contractor fee <xsl:value-of select="fee" />, is<xsl:if test="vat='no'"><span> not</span></xsl:if> a VAT payer
</xsl:template>
</xsl:stylesheet>
,承包商费用,不是增值税纳税人
mygod。。。谢谢:)我以前有一个引号,但它抛出了一些错误。。。但现在我认为这与我删除的引语无关:D
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/company/division/employees/employee">
<xsl:value-of select="company" />, contractor fee <xsl:value-of select="fee" />, is<xsl:if test="vat='no'"><span> not</span></xsl:if> a VAT payer
</xsl:template>
</xsl:stylesheet>