Module: Avv2word::XSLTHelper

Included in:
Document
Defined in:
lib/avv2word/helpers/xslt_helper.rb

Instance Method Summary collapse

Instance Method Details

#document_xslt(extras = false) ⇒ Object



3
4
5
6
# File 'lib/avv2word/helpers/xslt_helper.rb', line 3

def document_xslt(extras = false)
  file_name = extras ? 'avv2word' : 'base'
  xslt_path(file_name)
end

#xslt(stylesheet_name: nil, stylesheet_path: nil) ⇒ Object



12
13
14
15
# File 'lib/avv2word/helpers/xslt_helper.rb', line 12

def xslt(stylesheet_name: nil, stylesheet_path: nil)
  return Nokogiri::XSLT(File.open(stylesheet_path)) if stylesheet_path
  Nokogiri::XSLT(File.open(xslt_path(stylesheet_name)))
end

#xslt_path(template_name) ⇒ Object



8
9
10
# File 'lib/avv2word/helpers/xslt_helper.rb', line 8

def xslt_path(template_name)
  File.join(Avv2word.config.default_xslt_path, "#{template_name}.xslt")
end