我想使用 EXSLT 的函数 math:random() 但我不能让它工作。这是我的测试,文件 xslt:
<xsl:stylesheet xmlns:math="http://exslt.org/math" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" extension-element-prefixes="math">
<xsl:import href="math.xsl"/>
<xsl:template match="/">
<xsl:value-of select="(floor(math:random()*10) mod 10) + 1"/>
</xsl:template>
</xsl:stylesheet>
这是简单的文件 xml:
<?xml-stylesheet type="text/xsl" href="stile.xslt"?>
<radice>
ciao!
</radice>
这个例子不应该打印我“ciao!” 和一个从 1 到 10 的随机数?非常感谢您的帮助。