<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: gorg code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 22:14:19 GMT</pubDate>
    <description>DZone Snippets: gorg code</description>
    <item>
      <title>Using XSLT to generate SVG</title>
      <link>http://snippets.dzone.com/posts/show/5375</link>
      <description>This XSL file is intended to be used as an SVG XSL template file which displays SVG content using Gorg (XSLT back-end processor).&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;br /&gt;&lt;br /&gt;&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;&lt;br /&gt;&lt;br /&gt;&lt;xsl:output encoding="UTF-8"&lt;br /&gt;            method="xml"&lt;br /&gt;            indent="yes"/&gt;&lt;br /&gt;            &lt;br /&gt;  &lt;xsl:template match="mainpage"&gt;&lt;br /&gt;  &lt;svg xmlns="http://www.w3.org/2000/svg" width="100%"&lt;br /&gt;                xmlns:xlink="http://www.w3.org/1999/xlink" &gt;&lt;br /&gt;&lt;br /&gt;    &lt;g&gt;&lt;br /&gt;    &lt;text font-size="12pt" x="50" y="50" id="t2" stroke="olive"&gt;&lt;xsl:value-of select="title"/&gt;&lt;/text&gt;&lt;br /&gt;    &lt;/g&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/svg&gt;&lt;br /&gt;  &lt;/xsl:template&gt;&lt;br /&gt;&lt;/xsl:stylesheet&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Reference: 'using XSLT to generate SVG' http://snurl.com/24pwo [carto.net] </description>
      <pubDate>Thu, 17 Apr 2008 10:45:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5375</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Save a Ruby source text file to XML.</title>
      <link>http://snippets.dzone.com/posts/show/5163</link>
      <description>This code will output a text file as an XML file which can later be transformed into an HTML file using a back-end XSLT processor called Gorg.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/ruby &lt;br /&gt;&lt;br /&gt;#file: rubytxt2xml.rb&lt;br /&gt;&lt;br /&gt;require 'rexml/document'&lt;br /&gt;include REXML&lt;br /&gt;&lt;br /&gt;class RubyTxt2XML&lt;br /&gt;  &lt;br /&gt;  def rubytxt2xml(h)&lt;br /&gt;    h[:infilepath] = './' if h[:infilepath].nil?&lt;br /&gt;    h[:outfilepath] = './' if h[:outfilepath].nil?&lt;br /&gt;    h[:xmlfile] = h[:sourcefile][/^(.*)\.\w+$/,1] + '.xml' if h[:xmlfile].nil?&lt;br /&gt;    buffer = File.new(h[:infilepath] + h[:sourcefile],'r').read&lt;br /&gt;    &lt;br /&gt;    doc = Document.new&lt;br /&gt;    doc.add_element('ruby_txt')&lt;br /&gt;    body = Element.new('source')&lt;br /&gt;    body.text = CData.new(buffer)&lt;br /&gt;    doc.root.add_element(body)&lt;br /&gt;    &lt;br /&gt;    file = File.new(h[:outfilepath] + h[:xmlfile],'w')&lt;br /&gt;    file.puts doc&lt;br /&gt;    file.close&lt;br /&gt;    &lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;if __FILE__ == $0&lt;br /&gt;  rt2x = RubyTxt2XML.new&lt;br /&gt;  rt2x.rubytxt2xml(:sourcefile  =&gt; 'rubytxt2xml.rb')&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;output:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;ruby_txt&gt;&lt;br /&gt;  &lt;source&gt;&lt;br /&gt;    &lt;![CDATA[&lt;br /&gt;      #!/usr/bin/ruby &lt;br /&gt;&lt;br /&gt;      #file: rubytxt2xml.rb&lt;br /&gt;&lt;br /&gt;      require 'rexml/document'&lt;br /&gt;      include REXML&lt;br /&gt;&lt;br /&gt;      class RubyTxt2XML&lt;br /&gt;        &lt;br /&gt;        def rubytxt2xml(h)&lt;br /&gt;          h[:infilepath] = './' if h[:infilepath].nil?&lt;br /&gt;          h[:outfilepath] = './' if h[:outfilepath].nil?&lt;br /&gt;          h[:xmlfile] = h[:sourcefile][/^(.*)\.\w+$/,1] + '.xml' if h[:xmlfile].nil?&lt;br /&gt;          buffer = File.new(h[:infilepath] + h[:sourcefile],'r').read&lt;br /&gt;          &lt;br /&gt;          doc = Document.new&lt;br /&gt;          doc.add_element('ruby_txt')&lt;br /&gt;          body = Element.new('source')&lt;br /&gt;          body.text = CData.new(buffer)&lt;br /&gt;          doc.root.add_element(body)&lt;br /&gt;          &lt;br /&gt;          file = File.new(h[:outfilepath] + h[:xmlfile],'w')&lt;br /&gt;          file.puts doc&lt;br /&gt;          file.close&lt;br /&gt;          &lt;br /&gt;        end&lt;br /&gt;      end&lt;br /&gt;&lt;br /&gt;      if __FILE__ == $0&lt;br /&gt;        rt2x = RubyTxt2XML.new&lt;br /&gt;        rt2x.rubytxt2xml(:sourcefile  =&gt; 'rubytxt2xml.rb')&lt;br /&gt;      end&lt;br /&gt;    ]]&gt;&lt;br /&gt;  &lt;/source&gt;&lt;br /&gt;&lt;/ruby_txt&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 22 Feb 2008 15:18:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5163</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
  </channel>
</rss>
