如何解决“[xslt]找不到匹配的1-参数函数”异常?

时间:2013-09-10 12:49:43

标签: webdriver selenium-webdriver testng xslt-2.0

我在iPhone模拟器上执行selenium脚本,我通过ios-server0.6.3.jar运行服务器。我可以通过在safari浏览器上运行脚本来获取Mac上的所有xslt报告,但是当我尝试在iPhone模拟器上执行相同的脚本时,获取以下xslt异常..

[xslt] Processing /test-output/testng-results.xml to /XSLT_Reports/output/index.html
[xslt] Loading stylesheet /src/xslt/testng-results.xsl
[xslt] /src/xslt/testng-results.xsl:461:93:
Fatal Error! Cannot find a matching 1-argument function named {http://exslt.org/math}cos().
There is no Saxon extension function with the local name cos
[xslt] /src/xslt/testng-results.xsl:462:98: Fatal Error! Cannot find a matching 1-argument function named {http://exslt.org/math}sin(). There is no Saxon extension function with the local name sin
[xslt] /src/xslt/testng-results.xsl:466:111: Fatal Error! Cannot find a matching 1-argument function named {http://exslt.org/math}cos(). There is no Saxon extension function with the local name cos
[xslt] /src/xslt/testng-results.xsl:467:118: Fatal Error! Cannot find a matching 1-argument function named {http://exslt.org/math}sin(). There is no Saxon extension function with the local name sin 

以下代码可能会产生问题:

<xsl:variable name="pi" select="3.141592"/>
<xsl:variable name="radius" select="130"/>

<xsl:variable name="failedPercent" select="format-number($failedCount div $totalCount, '###%')"/>
<xsl:variable name="failedAngle" select="($failedCount div $totalCount) * $pi * 2"/>
<xsl:variable name="failedX" select="$radius * math:cos($failedAngle)"/>
<xsl:variable name="failedY" select="-1 * $radius * math:sin($failedAngle)"/>
<xsl:variable name="failedArc" select="if ($failedAngle >= $pi) then 1 else 0"/>

<xsl:variable name="failedAngle_text" select="$failedAngle div 2"/>
<xsl:variable name="failedX_text" select="($radius div 2) * math:cos($failedAngle_text)"/>
<xsl:variable name="failedY_text" select="(-1 * ($radius div 2) * math:sin($failedAngle_text))"/>

1 个答案:

答案 0 :(得分:0)

  

最后我解决了我的问题。实际上ios-server.jar在生成xslt报告时遇到了问题。因此,在执行脚本之后,我从构建路径中删除了ios-driver.jar文件,然后运行命令以生成xslt报告。