如何传递参数并在我的 xslt 中使用它 [英] how to pass a parameter and use that in my xslt

查看:32
本文介绍了如何传递参数并在我的 xslt 中使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 xml 文件和一个相关的 xslt 文件.我正在使用 msxsl.exe,我需要将参数作为命令行参数传递并在我的 xslt 文件中使用它.我该怎么做???

i have a xml file and a related xslt file. I am using msxsl.exe and i need to pass a parameter as a command line argument and use that in my xslt file. how can i do that???

命令:

msxsl.exe country.xml sheet.xslt -o country_sheet.html p1="india"

如何在我的 xslt 文件中检索值 india?

how to retrieve the value india in my xslt file?

推荐答案

试试这个

<xsl:param name="p1" select="p1"/>

这将在任何模板之外,有点像全局变量

this would be outside any templates, acting somewhat like a global variable

是的,然后要使用它的内容,您可以在模板中使用它

yes then to use the contents of this you could use this inside a template

<xsl:value-of select="$p1"/>

这篇关于如何传递参数并在我的 xslt 中使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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