将XSLT变量设置为JavaScript变量? [英] Setting an XSLT variable as a JavaScript variable?

查看:61
本文介绍了将XSLT变量设置为JavaScript变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何获取XSLT变量并使用它来设置JavaScript变量?

How would I grab an XSLT variable and use it to set a JavaScript variable?

我正在研究一些AJAX并使其工作我希望能够获取XSLT变量,并使用它们设置一些JavaScript变量的默认值,然后用jQuery操作。

I'm working on a bit of AJAX and in order to make it work to the fullest I would like to be able to grab XSLT variables and use those to set the default values of some JavaScript variables that I'll then be manipulating with jQuery.

推荐答案

在输出JavaScript的XSLT部分中粘贴以下内容。

Stick something like the following in your XSLT part that outputs the JavaScript.

<xsl:variable name="myvar" select="'red'" />
<xsl:text>var myobj="</xsl:text><xsl:value-of select="$myvar"></xsl:value-of><xsl:text>"</xsl:text>

这篇关于将XSLT变量设置为JavaScript变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆