[英]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. 现在我有了XML格式的信息,我需要使用stylesheet.xslt进行转换以接收HTML表。 I try to put this HTML table into my admin page(I use active admin), but get text of my html file.
我尝试将此HTML表放入管理页面(我使用活动管理),但获取HTML文件的文本。 However I would like to see a table after converting
但是我想在转换后看到一张表
I tried to put it into different tags(div/pre), don't help 我试图将其放入不同的标签(div / pre),无济于事
pre id: 'response_xml_into_html', class: 'collapse' do
document = Nokogiri::XML(request)
template = Nokogiri::XSLT(File.read('stylesheet.xslt'))
template.transform(document)
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. 另外,请确保启动
rails console
查看转换是否确实有效。 Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.