因为我要用IE浏览器看效果,所以不能直接使用str:replace函数,因此通过调用str:replace template来实现功能,首先发现str.replace.template.xsl模板里引用了exsl:node-set这个函数,需要先将他们都改成msxsl:node-set(xmlns声明也要改一下,不写出来了)。
在自己的XSLT里调用这个模板,将类似http://www.abc.com/的地址转为http://abc.abc.com/
<xsl:call-template name="str:replace">
<xsl:with-param name="string" select="'http://www.abc.com/'" />
<xsl:with-param name="search" select="'www'" />
<!--这个secDomain代表某个二级域名-->
<!--这个secDomain代表某个二级域名-->
<xsl:with-param name="replace" select="secDomain/text()" />
</xsl:call-template>
第三个with-param如果不使用test()则返回例如http://<secDomain>abc</secDomain>.abc.com/的
值
PS:在使用<xsl:variable>元素调用上述模板时,变量会包含变量节点内的所有内容(空格,换行等)。