簡體   English   中英

xsl:choose表達式必須計算為節點集

[英]xsl:choose Expression must evaluate to a node-set

我正在使用C#XSLT 2.0 我對其中一個模板有疑問,它似乎已經超出了<xsl:choose>語句。 傳遞的值是Key - Value對,除兩個值外的所有值都是小數。 目的是格式化與2位小數小數和,上萬種,而整數應該沒有小數位。

<xsl:choose>
      <xsl:when test="Key='Seller count' || Key='Buyer count'">
        <td>
          <xsl:value-of select="format-number(Value, '0')"/>
        </td>
      </xsl:when>
      <xsl:otherwise>
        <td>
          <xsl:value-of select="format-number(Value, '#,##0.00')"/>
        </td>
      </xsl:otherwise>
    </xsl:choose>` 

給我

An exception of type 'System.Xml.Xsl.XslTransformException' occurred in     System.Data.SqlXml.dll but was not handled in user code

Additional information: Expression must evaluate to a node-set.

這是有些令人驚訝,因為它得到開閉<td> </td>到兩個whenotherwise

我假設這是我看不到的明顯現象。

XSLT 1.0具有聯合運算符| 適用於節點集,適用於布爾值的布爾值or運算符。 沒有|| XSLT中的運算符,無論是1.0還是2.0。 如果要編寫布爾值or表達式,請使用<xsl:when test="Key='Seller count' or Key='Buyer count'">

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM