Ivan Skotsyk
Ivan Skotsyk

Reputation: 157

How to add html file into active admin page and make it a part of page?

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

Answers (1)

Sjors Branderhorst
Sjors Branderhorst

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

Related Questions