以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XSL/XSLT/XSL-FO/CSS 』  (http://bbs.xml.org.cn/list.asp?boardid=8)
----  xsl:function不能运行  (http://bbs.xml.org.cn/dispbbs.asp?boardid=8&rootid=&id=74768)


--  作者:zhengol
--  发布时间:5/11/2009 11:34:00 AM

--  xsl:function不能运行
在w3c里面有个xsl:function的用法示例如下。

<xsl:transform
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:str="http://example.com/namespace"
  version="2.0"
  exclude-result-prefixes="str">

<xsl:function name="str:reverse" as="xs:string">
  <xsl:param name="sentence" as="xs:string"/>
  <xsl:sequence  
     select="if (contains($sentence, ' '))
             then concat(str:reverse(substring-after($sentence, ' ')),
                         ' ',
                         substring-before($sentence, ' '))
             else $sentence"/>
</xsl:function>

<xsl:template match="/">
<output>
  <xsl:value-of select="str:reverse('DOG BITES MAN')"/>
</output>
</xsl:template>

</xsl:transform>

拷贝到xmlspy运行,指定xml文件后,发现不能运行。

xmlspy提示: XSLT 2.0 Debugging Error: No context item available.

请哪位大虾帮看看是什么问题?谢了先~。


--  作者:zhengol
--  发布时间:5/11/2009 7:22:00 PM

--  
自己顶一下。
--  作者:hexun831012
--  发布时间:5/12/2009 1:18:00 AM

--  
2.0~~~
--  作者:Qr
--  发布时间:5/12/2009 1:15:00 PM

--  
以下是引用hexun831012在2009-5-12 1:18:00的发言:
2.0~~~


走在前面未尝不是好事,但偶更注实用
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
31.250ms