11

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

command:

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

how to retrieve the value india in my xslt file?

Dimitre Novatchev
  • 240,661
  • 26
  • 293
  • 431
sulakshana
  • 183
  • 1
  • 2
  • 5

1 Answers1

7

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"/>
Treemonkey
  • 2,133
  • 11
  • 24
  • thank you so much.... after this line can i use $p1 in for-each select="Root/Row[$p1] statements na???????? – sulakshana Dec 01 '10 at 09:32
  • my xml file contains a line OK so i am passing india as an argument. now i need to check if india==ok then some other lines.. – sulakshana Dec 01 '10 at 09:41
  • i got this working. but i want use it in a if statement. i need to change this line so as to include the $p1. As my xml file contains OK – sulakshana Dec 01 '10 at 09:59
  • 1
    Consider to post a sample of the XML you have, we would really need to see some context to help you with the specific code. You could try `...` if you want a for-each to process all `Row` elements having a child element of the name the parameter `p1` has and where the value of that element is 'OK'. If that does not help then please add a sample of your XML input in your question. – Martin Honnen Dec 01 '10 at 11:26
  • @Martin Honnen - thank you so much... its working now.. with the same command.... – sulakshana Dec 02 '10 at 06:21