0
我正在努力做一個有條件的櫃檯。我的XML是:依情況而計XSLT
<comments>
<comment>
<name>Jonh</name>
<num>4/7</num>
</comment>
<comment>
<name>Mary</name>
<num>2/9</num>
</comment>
<comment>
<name>Catie</name>
<num>12/2</num>
</comment>
<comment>
<name>Stefen</name>
<num>127/300</num>
</comment>
</comments>
標籤的結構如下:
number1/number2
而且我想知道的是數字1的頻率比在所有標籤的NUMBER2更大
我試着與計數:
count(tokenize(//comment/num, '/')[1] > tokenize(//comment/num, '/')[2])
但沒有結果。我想過使用變量作爲計數器,但它們是不可變的。我該如何解決這個問題?
坎我嘗試使用可變這樣的: 「的 」但不返回結果! –
@JohnSoart你確定你的處理器支持XSLT 2.0而不僅僅是1.0嗎? 'tokenize'函數在1.0中不可用,但如其他答案中的建議,您可以使用'substring-before(。,'/')'和'substring-after(。,'/')'而不是'tokenize (...)[1]'和[2]'。 –