如何传递参数并在我的xslt中使用它

时间:2022-08-25 16:37:06

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???

我有一个xml文件和一个相关的xslt文件。我使用msxsl.exe,我需要传递一个参数作为命令行参数,并在我的xslt文件中使用它。我怎样才能做到这一点???

command:

命令:

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

how to retrieve the value india in my xslt file?

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

1 个解决方案

#1


4  

try this

尝试这个

<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"/>

#1


4  

try this

尝试这个

<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"/>