xslt passing parameter

47 views
Skip to first unread message

unbewusst

unread,
Jan 29, 2012, 6:44:15 AM1/29/12
to nokogi...@googlegroups.com
Hey all,

here is my code :
doc   = Nokogiri::XML(File.read(find_latest_xml))
xslt  = Nokogiri::XSLT(File.read("#{@sites_xml_fo}/#{@xsl_fbn}"))
puts xslt.transform(doc, ["lang", "fr"])

in the style sheet i have :
...
  <xsl:variable name="title">Title</xsl:variable>
...
    <h2>$lang = <xsl:value-of select="$lang"/></h2>

just to try out ))

and i get :
...
    <h2>$lang = </h2>
...

that's to say the parameter is seems to be empty, why ?

and also i do have a number of parameters to send to xslt, how to send more than one, like that :
xslt.transform(doc, ["lang", "fr", "param2", "value2", ..., "paramn", "valuen"])

???

best,

Yvon

unbewusst

unread,
Jan 29, 2012, 8:22:39 AM1/29/12
to nokogi...@googlegroups.com
in fact we have to put string values beween '', like that :
puts xslt.transform(doc, ["lang", "'fr'", "fullname", "'Yvon Thoraval'"])

that's all folks !


Reply all
Reply to author
Forward
0 new messages