Reputation: 157
Now I have information in XML format, I need to convert it with stylesheet.xslt to receive HTML table. I try to put this HTML table into my admin page(I use active admin), but get text of my html file. However I would like to see a table after converting
I tried to put it into different tags(div/pre), don't help
pre id: 'response_xml_into_html', class: 'collapse' do
document = Nokogiri::XML(request)
template = Nokogiri::XSLT(File.read('stylesheet.xslt'))
template.transform(document)
Upvotes: 0
Views: 354
Reputation: 2182
Am not sure, but try this:
document = Nokogiri::XML(request)
template = Nokogiri::XSLT(File.read('stylesheet.xslt'))
htmltable_out = template.transform(document)
div(id: 'response_xml_into_html', class: 'collapse') do
htmltable_out.html_safe
end
Also make sure to start a rails console
en see whether the transformation indeed works. Good luck!
Upvotes: 1