XSLT transform with params

147 views
Skip to first unread message

Jud

unread,
Nov 10, 2009, 12:55:24 AM11/10/09
to nokogiri-talk
I'm confused by the documentation around calling xslt transform() with
params.

I'm calling xslt.transform(doc), ['foo', 'bar']), but referencing $foo
in my xslt (e.g. <xsl:value-of select="$foo"/>) yields nothing. How is
that array supposed to be formatted?

Mike Dalessio

unread,
Nov 10, 2009, 7:08:30 AM11/10/09
to nokogi...@googlegroups.com
Without an example script I can't be sure (hint, hint), but I think I know what the issue is here.

Please try quoting the parameters passed to transform(). Either of the following would work:

xslt.transform(doc, Nokogiri::XSLT.quote_params(['foo', 'bar']))
or
xslt.transform(doc, Nokogiri::XSLT.quote_params('foo' => 'bar'))

I've added a new test case to master demonstrating that this is the way to call it:


Cheers.
--
mike dalessio
mi...@csa.net

Judson Valeski

unread,
Nov 10, 2009, 10:40:05 AM11/10/09
to nokogi...@googlegroups.com
the quote_params did it. perfect. thanks!

Jud

Honza Kotrs

unread,
Aug 29, 2015, 6:33:22 PM8/29/15
to nokogiri-talk
Perfect, still relevant today.;) Thanks!

Dne úterý 10. listopadu 2009 13:08:30 UTC+1 Mike Dalessio napsal(a):
Reply all
Reply to author
Forward
0 new messages