From: Mike Dalessio Date: 2010-11-29T22:57:50+09:00 Subject: Re: Add XSL stylesheet using Nokogiri --90e6ba6e8f6cdf672f0496317309 Content-Type: text/plain; charset=ISO-8859-1 On Thu, Nov 25, 2010 at 3:09 PM, niklas | brueckenschlaeger < niklas@brueckenschlaeger.de> wrote: > > http://stackoverflow.com/questions/3166544/associate-an-xml-stylesheet-with-an-xml-document-with-nokogiri 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 # => # # foo > > > On Fri, 2010-11-26 at 05:05 +0900, Hagbard Celine wrote: > > 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 > > > > > > > > I haven't found a way to do this with Nokogiri. Does anyone know a > > solution to my problem? Any help is appreciated. > > > > --90e6ba6e8f6cdf672f0496317309--