libxslt-ruby 0.6.0-x86-mswin32-60 → 0.7.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/README +125 -136
  2. data/doc/classes/XSLT.html +215 -0
  3. data/doc/classes/XSLT/Stylesheet.html +244 -0
  4. data/doc/classes/XSLT/TransformContext.html +111 -0
  5. data/doc/created.rid +1 -0
  6. data/doc/files/CHANGES.html +168 -0
  7. data/doc/files/LICENSE.html +133 -0
  8. data/doc/files/README.html +269 -0
  9. data/doc/files/ext/libxslt/libxslt_c.html +101 -0
  10. data/doc/files/ext/libxslt/ruby_xslt_stylesheet_c.html +101 -0
  11. data/doc/files/ext/libxslt/ruby_xslt_transform_context_c.html +101 -0
  12. data/doc/files/lib/deprecated_rb.html +101 -0
  13. data/doc/files/lib/libxslt_rb.html +110 -0
  14. data/doc/fr_class_index.html +29 -0
  15. data/doc/fr_file_index.html +34 -0
  16. data/doc/fr_method_index.html +28 -0
  17. data/doc/index.html +24 -0
  18. data/doc/rdoc-style.css +208 -0
  19. data/ext/libxslt/libxslt.c +21 -212
  20. data/ext/libxslt/libxslt.h +0 -17
  21. data/ext/libxslt/ruby_xslt_stylesheet.c +135 -173
  22. data/ext/libxslt/ruby_xslt_stylesheet.h +5 -10
  23. data/ext/libxslt/ruby_xslt_transform_context.c +5 -2
  24. data/ext/libxslt/version.h +2 -2
  25. data/lib/deprecated.rb +66 -0
  26. data/lib/libxslt.rb +1 -0
  27. data/lib/libxslt_ruby.so +0 -0
  28. data/mingw/libxslt_ruby.so +0 -0
  29. data/tests/files/commentary.dtd +34 -0
  30. data/tests/files/fuzface.xml +154 -0
  31. data/tests/files/fuzface.xsl +4 -0
  32. data/tests/files/params.xml +2 -0
  33. data/tests/files/params.xsl +11 -0
  34. data/tests/files/ramblings.xsl +46 -0
  35. data/tests/test_deprecated.rb +99 -0
  36. data/tests/test_libxslt.rb +21 -0
  37. data/tests/test_stylesheet.rb +64 -0
  38. data/tests/test_suite.rb +3 -0
  39. data/vc/libxslt_ruby.sln +1 -1
  40. data/vc/libxslt_ruby.vcproj +3 -3
  41. metadata +41 -10
  42. data/mingw/mingw.rake +0 -36
data/README CHANGED
@@ -1,153 +1,142 @@
1
- == INSTALLATION
1
+ = libxslt-ruby
2
2
 
3
- Installation is simple. Follow the following steps:
3
+ == Overview
4
4
 
5
- === Rubygems
5
+ The libxslt gem provides Ruby language bindings for GNOME's Libxslt
6
+ toolkit. It is free software, released under the MIT License.
6
7
 
7
- gem install libxsl-ruby
8
-
9
- === Tarball/zip
10
8
 
11
- $ rake test
12
- $ rake install
9
+ == Requirements
13
10
 
14
- If extconf yacks up an error, follow the instructions it provides.
15
- You will need to chdir to ext/xml and run 'ruby extconf.rb' to provide
16
- options, after which you can either use Rake for everything or
17
- do with make (make && make install).
11
+ libxslt-ruby requires Ruby 1.8.4 or higher. It is dependent on
12
+ the following libraries to function properly:
18
13
 
19
- Once installed, look at the test scripts (tests/*.rb), and run
20
- 'rake doc' to generate API documentation.
14
+ * libm (math routines: very standard)
15
+ * libz (zlib)
16
+ * libiconv
17
+ * libxml2
18
+ * libxslt
19
+ * libxml-ruby bindings
21
20
 
22
- == DOCUMENTATION
21
+ If you are running Linux or Unix you'll need a C compiler so the extension
22
+ can be compiled when it is installed. If you are running Windows, then install the Windows specific RubyGem which
23
+ includes an already built extension.
23
24
 
24
- RDoc comments are included - run 'rake doc' to generate documentation.
25
- You can find the latest documentation at:
25
+ !!!NOTE!!! The libxml-ruby and libxslt-ruby bindings must absolutely, positively,
26
+ without a doubt share the same libxml2 library. This is because libxslt modifies
27
+ XML documents created by libxml2. If there are two copies of libxml2 on your
28
+ system, then when XML documents allocated in copy #1 are manipulated by copy #2,
29
+ a segmentation fault will occur. So make sure that your system has only one copy of libxml2
30
+ installed.
26
31
 
27
- * http://libxsl.rubyforge.org
28
32
 
29
- == USAGE EXAMPLE
33
+ == INSTALLATION
30
34
 
31
- *Note*: To use libxsl-ruby, you have to require both 'xml/libxml' and
32
- 'xml/libxslt'. The following example is an abridged version of that
33
- included with the distribution, which you can run with:
35
+ The easiest way to install libxslt-ruby is via Ruby Gems. To install:
34
36
 
35
- $ cd tests
36
- $ ruby fuzface.rb
37
-
37
+ <tt>gem install libxslt-ruby</tt>
38
+
39
+ If you are running Windows, make sure to install the Win32 RubyGem which
40
+ includes an already built binary file. The binary is built against
41
+ libxml2 version 2.6.32, iconv version 1.12 and libxslt version 1.1.24.
42
+ Binaries for libxml2 and iconv are provided in the libxml-ruby bindings,
43
+ while a binary for libxslt is provided in the libxslt-ruby bindings.
44
+ These binaries should be put either in the libxslt/lib directory
45
+ or on the Windows path.
46
+
47
+ The Windows binaries are biult with MingW. The gem also includes
48
+ a Microsoft VC++ 2005 solution. If you wish to run a debug version
49
+ of libxml-ruby on Windows, then it is highly recommended
50
+ you use VC++.
51
+
52
+
53
+ == USAGE
54
+
38
55
  Given an XML file like:
39
56
 
40
- <?xml version="1.0" encoding="UTF-8"?>
41
- <?xml-stylesheet href="fuzface.xsl" type="text/xsl"?>
42
-
43
- <commentary>
44
- <meta>
45
- <author>
46
- <first_name>Sean</first_name>
47
- <last_name>Chittenden</last_name>
48
- <email>sean@chittenden.org</email>
49
- </author>
50
- <version>$Version$</version>
51
- <date>$Date: 2007-08-29 12:18:15 -0600 (Wed, 29 Aug 2007) $</date>
52
- <id>$Id: README 33 2007-08-29 18:18:15Z transami $</id> <title>Fuzface...</title>
53
- <subtitle>The Internet's a big place and here's some proof...</subtitle>
54
- </meta>
55
-
56
- <body>
57
- <para>
58
- I think it's a tragedy that I'm going to start off my new
59
- commentary by talking about facial hair and the Internet.
60
- Something about that just screams pathetic, but whatever: it's
61
- humor and that's life.
62
- </para>
63
- </body>
64
- </commentary>
65
-
66
- And an XSLT like:
67
-
68
- <?xml version="1.0" ?>
69
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
70
- <xsl:template match="/">
71
- <xsl:element name="html">
72
- <xsl:element name="head">
73
- <xsl:element name="title">Ramblings - <xsl:value-of select="commentary/meta/title" /> - <xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
74
- </xsl:element>
75
-
76
- <xsl:element name="body">
77
- <xsl:element name="h1"><xsl:value-of select="commentary/meta/title" /></xsl:element>
78
- <xsl:element name="h3"><xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
79
- By: <xsl:value-of select="commentary/meta/author/first_name" /> <xsl:value-of select="commentary/meta/author/last_name" /><xsl:element name="br" />
80
- Date: <xsl:value-of select="commentary/meta/date" /><xsl:element name="br" />
81
-
82
- <xsl:for-each select="./commentary/body">
83
- <xsl:apply-templates />
84
- </xsl:for-each>
85
-
86
- </xsl:element>
87
- </xsl:element>
88
- </xsl:template>
89
-
90
- <xsl:template match="para">
91
- <xsl:element name="p">
92
- <xsl:value-of select="." />
93
- </xsl:element>
94
- </xsl:template>
95
- </xsl:stylesheet>
57
+ <?xml version="1.0" encoding="UTF-8"?>
58
+ <?xml-stylesheet href="fuzface.xsl" type="text/xsl"?>
59
+
60
+ <commentary>
61
+ <meta>
62
+ <author>
63
+ <first_name>Sean</first_name>
64
+ <last_name>Chittenden</last_name>
65
+ <email>sean@chittenden.org</email>
66
+ </author>
67
+ <version>$Version$</version>
68
+ <date>$Date: 2008-07-10 00:39:47 -0600 (Thu, 10 Jul 2008) $</date>
69
+ <id>$Id: README 64 2008-07-10 06:39:47Z cfis $</id> <title>Fuzface...</title>
70
+ <subtitle>The Internet's a big place and here's some proof...</subtitle>
71
+ </meta>
72
+
73
+ <body>
74
+ <para>
75
+ I think it's a tragedy that I'm going to start off my new
76
+ commentary by talking about facial hair and the Internet.
77
+ Something about that just screams pathetic, but whatever: it's
78
+ humor and that's life.
79
+ </para>
80
+ </body>
81
+ </commentary>
82
+
83
+ And an XSLT file like this:
84
+
85
+ <?xml version="1.0" ?>
86
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
87
+ <xsl:template match="/">
88
+ <xsl:element name="html">
89
+ <xsl:element name="head">
90
+ <xsl:element name="title">Ramblings - <xsl:value-of select="commentary/meta/title" /> - <xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
91
+ </xsl:element>
92
+
93
+ <xsl:element name="body">
94
+ <xsl:element name="h1"><xsl:value-of select="commentary/meta/title" /></xsl:element>
95
+ <xsl:element name="h3"><xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
96
+ By: <xsl:value-of select="commentary/meta/author/first_name" /> <xsl:value-of select="commentary/meta/author/last_name" /><xsl:element name="br" />
97
+ Date: <xsl:value-of select="commentary/meta/date" /><xsl:element name="br" />
98
+
99
+ <xsl:for-each select="./commentary/body">
100
+ <xsl:apply-templates />
101
+ </xsl:for-each>
102
+
103
+ </xsl:element>
104
+ </xsl:element>
105
+ </xsl:template>
106
+
107
+ <xsl:template match="para">
108
+ <xsl:element name="p">
109
+ <xsl:value-of select="." />
110
+ </xsl:element>
111
+ </xsl:template>
112
+ </xsl:stylesheet>
96
113
 
97
114
  We can easily transform the XML with the following ruby code:
98
115
 
99
- # require 'rubygems' # if installed via gems
100
- require 'xml/libxml'
101
- require 'xml/libxslt'
102
-
103
- # Create a new XSL Transform
104
- xslt = XML::XSLT.file('fuzface.xsl')
105
- xslt.doc = XML::Document.file('fuzface.xml')
106
-
107
- # Parse to create a stylesheet, then apply.
108
- s = xslt.parse
109
- s.apply
110
-
111
- # To save the result to a file:
112
- File.open('fuzface.html', 'w') do |f|
113
- s.save(f)
114
- end
115
-
116
- # To output the result to stdout
117
- s.print
118
-
119
- To give the following result:
120
-
121
- <html>
122
- <head>
123
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
124
- <title>Ramblings - Fuzface... - The Internet's a big place and here's some proof...</title>
125
- </head>
126
- <body>
127
- <h1>Fuzface...</h1>
128
- <h3>The Internet's a big place and here's some proof...</h3>
129
- By: SeanChittenden<br>
130
- Date: $Date: 2007-08-29 12:18:15 -0600 (Wed, 29 Aug 2007) $<br>
131
- <p>
132
- I think it's a tragedy that I'm going to start off my new
133
- commentary by talking about facial hair and the Internet.
134
- Something about that just screams pathetic, but whatever: it's
135
- humor and that's life.
136
- </p>
137
- </body>
138
- </html>
139
-
140
- == If you checked out from CVS
141
-
142
- If you checked out the source from CVS, you must install a copy of
143
- the current (or matching) libxml-ruby headers in:
144
-
145
- ext/xml/libxml-ruby
146
-
147
- prior to running the above. This can be done via rake, and will
148
- happen automatically if ../libxml/ext/xml is found, or the
149
- LIBXMLH=/path/to/headers commandline option is supplied.
150
-
151
- # $Id: README 33 2007-08-29 18:18:15Z transami $
152
-
153
- # See the LICENSE file for copyright and distribution information
116
+ require 'libxslt'
117
+
118
+ # Create a new XSL Transform
119
+ stylesheet_doc = XML::Document.file('files/fuzface.xsl')
120
+ stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
121
+
122
+ # Transform a xml document
123
+ xml_doc = XML::Document.file('files/fuzface.xml')
124
+ result = stylesheet.apply(xml_doc)
125
+
126
+ You can then print, save or manipulate the returned document.
127
+
128
+ == License
129
+
130
+ See LICENSE for license information.
131
+
132
+ == DOCUMENTATION
133
+
134
+ RDoc comments are included - run 'rake doc' to generate documentation.
135
+ You can find the latest documentation at:
136
+
137
+ * http://libxsl.rubyforge.org/
138
+
139
+ == MORE INFORMATION
140
+
141
+ For more information please refer to the documentation. If you have any
142
+ questions, please send email to libxml-devel@rubyforge.org.
@@ -0,0 +1,215 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: XSLT</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">XSLT</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/ext/libxslt/libxslt_c.html">
59
+ ext/libxslt/libxslt.c
60
+ </a>
61
+ <br />
62
+ <a href="../files/ext/libxslt/ruby_xslt_stylesheet_c.html">
63
+ ext/libxslt/ruby_xslt_stylesheet.c
64
+ </a>
65
+ <br />
66
+ <a href="../files/ext/libxslt/ruby_xslt_transform_context_c.html">
67
+ ext/libxslt/ruby_xslt_transform_context.c
68
+ </a>
69
+ <br />
70
+ </td>
71
+ </tr>
72
+
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ The libxslt gem provides Ruby language bindings for GNOME&#8217;s Libxslt
86
+ toolkit. It is free software, released under the MIT License.
87
+ </p>
88
+ <p>
89
+ Using the bindings is straightforward:
90
+ </p>
91
+ <pre>
92
+ stylesheet_doc = XML::Document.file('stylesheet_file')
93
+ stylesheet = XSLT::Stylesheet.new(stylesheet_doc)
94
+
95
+ xml_doc = XML::Document.file('xml_file')
96
+ result = stylesheet.apply(xml_doc)
97
+ </pre>
98
+
99
+ </div>
100
+
101
+
102
+ </div>
103
+
104
+
105
+ </div>
106
+
107
+
108
+ <!-- if includes -->
109
+
110
+ <div id="section">
111
+
112
+ <div id="class-list">
113
+ <h3 class="section-bar">Classes and Modules</h3>
114
+
115
+ Class <a href="XSLT/Stylesheet.html" class="link">XSLT::Stylesheet</a><br />
116
+ Class <a href="XSLT/TransformContext.html" class="link">XSLT::TransformContext</a><br />
117
+
118
+ </div>
119
+
120
+ <div id="constants-list">
121
+ <h3 class="section-bar">Constants</h3>
122
+
123
+ <div class="name-list">
124
+ <table summary="Constants">
125
+ <tr class="top-aligned-row context-row">
126
+ <td class="context-item-name">MAX_DEPTH</td>
127
+ <td>=</td>
128
+ <td class="context-item-value">INT2NUM(xsltMaxDepth)</td>
129
+ </tr>
130
+ <tr class="top-aligned-row context-row">
131
+ <td class="context-item-name">MAX_SORT</td>
132
+ <td>=</td>
133
+ <td class="context-item-value">INT2NUM(XSLT_MAX_SORT)</td>
134
+ </tr>
135
+ <tr class="top-aligned-row context-row">
136
+ <td class="context-item-name">ENGINE_VERSION</td>
137
+ <td>=</td>
138
+ <td class="context-item-value">rb_str_new2(xsltEngineVersion)</td>
139
+ </tr>
140
+ <tr class="top-aligned-row context-row">
141
+ <td class="context-item-name">LIBXSLT_VERSION</td>
142
+ <td>=</td>
143
+ <td class="context-item-value">INT2NUM(xsltLibxsltVersion)</td>
144
+ </tr>
145
+ <tr class="top-aligned-row context-row">
146
+ <td class="context-item-name">LIBXML_VERSION</td>
147
+ <td>=</td>
148
+ <td class="context-item-value">INT2NUM(xsltLibxmlVersion)</td>
149
+ </tr>
150
+ <tr class="top-aligned-row context-row">
151
+ <td class="context-item-name">XSLT_NAMESPACE</td>
152
+ <td>=</td>
153
+ <td class="context-item-value">rb_str_new2((const char*)XSLT_NAMESPACE)</td>
154
+ </tr>
155
+ <tr class="top-aligned-row context-row">
156
+ <td class="context-item-name">DEFAULT_VENDOR</td>
157
+ <td>=</td>
158
+ <td class="context-item-value">rb_str_new2(XSLT_DEFAULT_VENDOR)</td>
159
+ </tr>
160
+ <tr class="top-aligned-row context-row">
161
+ <td class="context-item-name">DEFAULT_VERSION</td>
162
+ <td>=</td>
163
+ <td class="context-item-value">rb_str_new2(XSLT_DEFAULT_VERSION)</td>
164
+ </tr>
165
+ <tr class="top-aligned-row context-row">
166
+ <td class="context-item-name">DEFAULT_URL</td>
167
+ <td>=</td>
168
+ <td class="context-item-value">rb_str_new2(XSLT_DEFAULT_URL)</td>
169
+ </tr>
170
+ <tr class="top-aligned-row context-row">
171
+ <td class="context-item-name">NAMESPACE_LIBXSLT</td>
172
+ <td>=</td>
173
+ <td class="context-item-value">rb_str_new2((const char*)XSLT_LIBXSLT_NAMESPACE)</td>
174
+ </tr>
175
+ <tr class="top-aligned-row context-row">
176
+ <td class="context-item-name">NAMESPACE_NORM_SAXON</td>
177
+ <td>=</td>
178
+ <td class="context-item-value">rb_str_new2((const char*)XSLT_NORM_SAXON_NAMESPACE)</td>
179
+ </tr>
180
+ <tr class="top-aligned-row context-row">
181
+ <td class="context-item-name">NAMESPACE_SAXON</td>
182
+ <td>=</td>
183
+ <td class="context-item-value">rb_str_new2((const char*)XSLT_SAXON_NAMESPACE)</td>
184
+ </tr>
185
+ <tr class="top-aligned-row context-row">
186
+ <td class="context-item-name">NAMESPACE_XT</td>
187
+ <td>=</td>
188
+ <td class="context-item-value">rb_str_new2((const char*)XSLT_XT_NAMESPACE)</td>
189
+ </tr>
190
+ <tr class="top-aligned-row context-row">
191
+ <td class="context-item-name">NAMESPACE_XALAN</td>
192
+ <td>=</td>
193
+ <td class="context-item-value">rb_str_new2((const char*)XSLT_XALAN_NAMESPACE)</td>
194
+ </tr>
195
+ </table>
196
+ </div>
197
+ </div>
198
+
199
+
200
+
201
+
202
+
203
+
204
+ <!-- if method_list -->
205
+
206
+
207
+ </div>
208
+
209
+
210
+ <div id="validator-badges">
211
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
212
+ </div>
213
+
214
+ </body>
215
+ </html>