Hi there.
I am generating a XML file using Nokogiri. I would like to add a XSL
stylesheet reference to the document. By XSL stylesheet reference I mean
<?xsl-stylesheet type="text/xsl" href="foo.xsl"?>
I haven’t found a way to do this with Nokogiri. Does anyone know a
solution to my problem? Any help is appreciated.
hagbard
3
Thank your very much. For some reason I wasn’t able to find any material
about that issue through Google. Quite disappointing answer though.
hagbard
4
On Thu, Nov 25, 2010 at 3:09 PM, niklas | brueckenschlaeger <
[email protected]> wrote:
OMG, there is so much fail here, I don’t know where to start.
Instead, I will simply submit the correct method without further
comment:
require “nokogiri”
doc = Nokogiri::XML “foo”
doc.root.add_previous_sibling
Nokogiri::XML::ProcessingInstruction.new(doc,
“xml-stylesheet”, ‘type=“text/xsl” href=“foo.xsl”’)
puts doc.to_xml
=> <?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="foo.xsl"?>
foo
hagbard
5
Great. Thank you. I didn’t know that.
hagbard
6