Sha256: 63fc5baf51d5542a3a87ef602ba96335ad2e74074b5cbafce737ed508eed238b

Contents?: true

Size: 749 Bytes

Versions: 23

Compression:

Stored size: 749 Bytes

Contents

module Htmltoooxml
  class Document
    include XSLTHelper

    class << self

    end

    def initialize()
      @replaceable_files = {}
    end

    def transform_doc_xml(source, extras = false)
      transformed_source = xslt(stylesheet_name: 'cleanup').transform(source)
      transformed_source = xslt(stylesheet_name: 'inline_elements').transform(transformed_source)
      transform_and_replace(transformed_source, document_xslt(extras), extras)
    end

    private

    def transform_and_replace(source, stylesheet_path, remove_ns = false)
      stylesheet = xslt(stylesheet_path: stylesheet_path)
      content = stylesheet.apply_to(source)
      content.gsub!(/\s*xmlns:(\w+)="(.*?)\s*"/, '') if remove_ns
      content
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
htmltoooxml-0.4.0 lib/htmltoooxml/document.rb
htmltoooxml-0.3.9 lib/htmltoooxml/document.rb
htmltoooxml-0.3.8 lib/htmltoooxml/document.rb
htmltoooxml-0.3.7 lib/htmltoooxml/document.rb
htmltoooxml-0.3.6 lib/htmltoooxml/document.rb
htmltoooxml-0.3.5 lib/htmltoooxml/document.rb
htmltoooxml-0.3.4 lib/htmltoooxml/document.rb
htmltoooxml-0.3.3 lib/htmltoooxml/document.rb
htmltoooxml-0.3.2 lib/htmltoooxml/document.rb
htmltoooxml-0.3.1 lib/htmltoooxml/document.rb
htmltoooxml-0.3.0 lib/htmltoooxml/document.rb
htmltoooxml-0.2.1 lib/htmltoooxml/document.rb
htmltoooxml-0.2.0 lib/htmltoooxml/document.rb
htmltoooxml-0.1.9 lib/htmltoooxml/document.rb
htmltoooxml-0.1.8 lib/htmltoooxml/document.rb
htmltoooxml-0.1.7 lib/htmltoooxml/document.rb
htmltoooxml-0.1.6 lib/htmltoooxml/document.rb
htmltoooxml-0.1.5 lib/htmltoooxml/document.rb
htmltoooxml-0.1.4 lib/htmltoooxml/document.rb
htmltoooxml-0.1.3 lib/htmltoooxml/document.rb