Class: XMLToXSL
Instance Attribute Summary collapse
-
#to_xsl ⇒ Object
readonly
Returns the value of attribute to_xsl.
Instance Method Summary collapse
-
#initialize(xml) ⇒ XMLToXSL
constructor
A new instance of XMLToXSL.
Constructor Details
#initialize(xml) ⇒ XMLToXSL
Returns a new instance of XMLToXSL.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xml_to_xsl.rb', line 16 def initialize(xml) doc = Document.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_xsl ⇒ Object (readonly)
Returns the value of attribute to_xsl.
13 14 15 |
# File 'lib/xml_to_xsl.rb', line 13 def to_xsl @to_xsl end |