XSL中的msxsl:script定义的函数,怎样将节点的cdata的节点的文本作为参数传进去?
xsl
=====
<?xml version= "1.0 " encoding= "utf-8 "?>
<xsl:stylesheet version= "1.0 "
xmlns:xsl= "http://www.w3.org/1999/XSL/Transform "
xmlns:dc= "http://purl.org/dc/elements/1.1/ "
xmlns:msxsl= "urn:schemas-microsoft-com:xslt "
xmlns:user= "http://www.chenjiliang.com ">
<xsl:output omit-xml-declaration= "yes " method= "html " indent= "yes "/>
<msxsl:script language= "javascript " implements-prefix= "user ">
<![CDATA[
function HtmlToText(text)
{
return text.replace( "> ", "> ")
.replace( "< ", " < ")
.replace( "' ", " ' ")
.replace( "" ", ' " ');
}
]]>
</msxsl:script>
这样调用错误
<xsl:value-of select= "user:HtmlToText(description) " />
如果这样就没问题,怎样才能将description节点的cdata中的内容传进HtmlToText这个函数?
<xsl:value-of select= "user:HtmlToText( 'description ') " />
xml
=====
<description>
- <![CDATA[ sdfd ]]>
</description>
[解决办法]
不太用xml
[解决办法]
Up
[解决办法]
up