bsuh / node_xslt

a simple XSLT addon for node
zlib License
71 stars 17 forks source link

Stuck on xslt parameters #7

Closed boozedog closed 12 years ago

boozedog commented 12 years ago

Thanks again for your help previously!

I'd like to pass some parameters into my stylesheet. I see the third argument for .transform is an array:

transformedString = xslt.transform(stylesheet, doc, []);

... presumably that's where the parameters go? If so can you tell me what data structure I need to use within that array? I looked at the docs for libxslt but they weren't very helpful ...

Thanks!

bsuh commented 12 years ago

It's a series of parameter names and parameter values like so: ['parameter1Name', 'parameter1Value', 'parameter2Name', 3]

I'll update the docs. Thanks.

boozedog commented 12 years ago

Thanks again for your help! I'm willing to work on the docs if you like ... let me know.

boozedog commented 12 years ago

Ah I see you've already done it.

PeterAronZentai commented 12 years ago

This one is not a real issue, maybe the README.md is a bit missleading: libxslt treats param values as XPath selectors. This makes it a bit tricky to pass string parameters, as you have to quote them so that they will be XPath constant values. xslt.transform(template, document,['param1', "'value'"])