xml文件:
<dt_2>
<id> 120 </id>
<NS_editor_id> 111 </NS_editor_id>
<NS_content> <DIV class=Section1 style="LAYOUT-GRID: 15.6pt none"> <P class=MsoNormal> <SPAN lang=EN-US> Fdafa </SPAN> </P> <P class=MsoNormal> <SPAN lang=EN-US> </SPAN> </P> <P class=MsoNormal> <SPAN lang=EN-US> </SPAN> </P> <P class=MsoNormal> <B> <I> <SPAN lang=EN-US> Fasfadsfafafdasfasfa </SPAN> </I> </B> </P> <P class=MsoNormal> <SPAN lang=EN-US> </SPAN> </P> <P class=MsoNormal style="MARGIN-LEFT: 21pt; TEXT-INDENT: -21pt"> <SPAN lang=EN-US style="BACKGROUND: yellow; FONT-FAMILY: Wingdings"> l <SPAN style="FONT: 7pt 'Times New Roman'"> </SPAN> </SPAN> <SPAN lang=EN-US style="BACKGROUND: yellow"> fasfafadsfdfa </SPAN> </P> <P class=MsoNormal> <SPAN lang=EN-US> </SPAN> </P> <P class=MsoNormal> <SPAN lang=EN-US> </SPAN> </P> <P class=MsoNormal> <SPAN lang=EN-US> </SPAN> </P> <P class=MsoNormal> <SPAN lang=EN-US> <IMG height=270 src="images/upload/mov.files/image001.jpg" width=360> </SPAN> </P> </DIV> </NS_content> 数据挖掘实验室
</dt_2>
xsl文件:
<xsl:when test="(position() mod 2)=1" >
ChangeVedio("upload/clock.avi"," <xsl:value-of select='NS_title'/> "," <xsl:value-of select='NS_content'/> ");
</xsl:when>
问题是:
我在用xsl取得 <NS_content> 中的内容,然后把它传给ChangeVedio()javascript函数,可这么写会报脚本错误,去掉
<xsl:value-of select='NS_content'/> 是可以的,问题应该就是html中的引号,请大虾指教,谢谢!ChangeVedio("upload/clock.avi"," <xsl:value-of select="NS_title"/> "," <xsl:value-of select="NS_content"/> ");
xsl中写js脚本时不必理会js中的字串定界符.
另外,注意把多的空格去一下.
也可以改一种写法:
ChangeVedio("upload/clock.avi","{NS_title}","{NS_Content}"); NS_content中是html标签,而且有单引号和双引号,楼上这么写好象不对阿,用了也不行~~~原来你的意思是指 Content节点值本身就含有一些东西..
那你只有将它的值进行针对js转义了.
var x="aa"aa";
比如 x里要出现"一样.
比较麻烦.
试试用xslt的函数,比如replace等等,在输出前就将节点值中含有js特列字符的东西转义.
简单的做法是试试用 <xsl:text及cdata把值输出.
Create By Any-Extract(WL-AE) 数据挖掘交友