Class: XMLToXSL

Inherits:
Object
  • Object
show all
Defined in:
lib/xml_to_xsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ XMLToXSL

Returns a new instance of XMLToXSL.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/xml_to_xsl.rb', line 12

def initialize(xml)

  doc = Rexle.new(xml)

@to_xsl = "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"\
" version='1.0'>

<xsl:template match='#{doc.root.name}'>

  <xsl:element name='#{doc.root.name}'>
#{write_attributes(doc.root.attributes).join("\n")}
    #{build_xml(doc.root)}
  </xsl:element>

</xsl:template>

</xsl:stylesheet>"

end

Instance Attribute Details

#to_xslObject (readonly)

Returns the value of attribute to_xsl.



10
11
12
# File 'lib/xml_to_xsl.rb', line 10

def to_xsl
  @to_xsl
end