Class: Nokogiri::XML::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/dor/utils/ng_tidy.rb

Instance Method Summary collapse

Instance Method Details

#prettifyObject


23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/dor/utils/ng_tidy.rb', line 23

def prettify
  xslt = Nokogiri::XSLT <<-EOC
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:template match="node()|@*">
      <xsl:copy>
        <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
    </xsl:template>
  </xsl:stylesheet>
  EOC
  xslt.transform(self).to_xml
end