如何将 html 文件添加到活动管理页面并使其成为页面的一部分?

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

现在我有 XML 格式的信息,我需要用 stylesheet.xslt 转换它以接收 HTML table。我尝试将此 HTML table 放入我的管理页面(我使用活动管理),但获取我的 html 文件的文本。但是我希望在转换

后看到 table

我试过把它放到不同的标签里(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)

我不确定,但试试这个:

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

还要确保启动 rails console en 看看转换是否确实有效。祝你好运!