views:

30

answers:

1

Is it possible to associate a stylesheet with with Nokogiri, to create this structure?

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="http://www.my-site.com/sitemap.xsl"?&gt;
<root>
  ...
</root>
A: 

There is not.

The way I did it:

xml.gsub!("<?xml version=\"1.0\"?>") do |head|
  result = head
  result << "\n"
  result << "<?xml-stylesheet type=\"text/xsl\" href=\"#{stylesheet}\"?>"
end

Cheers.

viatropos