libxslt-ruby 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 20cac3cd9b87d3ca87f9ce387708f6b23360512f
4
- data.tar.gz: 257a96d52ada6a45bf21a36795044d0a5bcbdcfd
2
+ SHA256:
3
+ metadata.gz: 23935ac18b5adb75aec9fdd5e595d87b4b9276d64eba921ee2566a0199fc8742
4
+ data.tar.gz: e717953b59a990acdab01278ee6231b99ef0f210720b4d96e7bdaeb4f33c9203
5
5
  SHA512:
6
- metadata.gz: cf874474b474d45ef7da41b4a94d4325f126b32cceae6519289181e867dbd78cbb28c2ab7e569a729baf32b09eb95bb4e04cb1adf15e3d42905e769fbfb0ad70
7
- data.tar.gz: b26f0ce01488b7946f08c1b1b1c80a28140c3bd67c3363febd761125ca164a3039a306a40f96012326f200eceb7a0b101529e4b7c2e32241ee9dbd95fe15537a
6
+ metadata.gz: 3209692840ac1993df27a2d2b7a57b81202ae133395346ce07b3a39ddb3f6be33d5a3114cbec2c9a8f74db614770f2b0848a80aa075cf1e812970c4c5ccec24b
7
+ data.tar.gz: dade40cc4641b523dae9eaf3cf991def8b6c9a0428621fcb74db38b70d18c8fd5043eda30ed2c01c863f1a4563a38035a55bc16a2ca1f8e34c4d5474d308349b
data/CHANGES CHANGED
@@ -1,154 +1,161 @@
1
- == 1.1.1 / 2014-03-16 Charlie Savage
2
-
3
- * Adds output and transform methods that respect the <xsl:output> options in stylesheets (Rick Frankel)
4
- * Update included binaries
5
- * Update extconf.rb to remove warnings
6
-
7
- == 1.1.0 / 2013-01-06 Charlie Savage
8
-
9
- * Update dependency to latest libxml-ruby version (Charlie Savage)
10
- * Remove dependency on dl which causes warning in Ruby 2.0.0 (Charlie Savage)
11
-
12
- == 1.0.9 / 2012-03-17 Charlie Savage
13
-
14
- * Build fix for library inclusion order (Andrew Watts)
15
- * Add pkg directory to gitignore (Travis Warlick)
16
-
17
- == 1.0.8 / 2011-09-03 Charlie Savage
18
-
19
- * Don't depend on exported data from libxml-ruby, doesn't work with VC++.
20
-
21
- == 1.0.7 / 2011-08-29 Charlie Savage
22
-
23
- * Don't require 'rake' in the gemspec to avoid annoying Bundler bugs
24
-
25
- == 1.0.6 / 2011-08-14
26
-
27
- * Fix compilation with Microsoft Visual Studio 2010 (Charlie Savage)
28
-
29
-
30
- == 1.0.5 / 2011-08-09
31
-
32
- * Fix Ruby 1.9.3-preview1 libxml 2.7.3 (OS X Lion) conflicting OnigUChar redefinition (Travis Warlick).
33
-
34
-
35
- == 1.0.4 / 2011-08-03
36
-
37
- * Don't link against libxml-ruby on OS X, as it is unnecessary and doesn't work
38
- - dylib vs bundle (Travis Warlick).
39
-
40
- * Add 'rake' to gemspec to enable use of :path option with Bundler (Travis Warlick).
41
-
42
- * Update test requires to work on Ruby 1.8.* and 1.9.* (Charlie Savage)
43
-
44
-
45
- == 1.0.3 / 2011-07-31
46
-
47
- * Added support for extension function registration. This was adapted from
48
- Gregoire Lejeune's ruby-xslt library at https://github.com/glejeune/ruby-xslt (Jens Willie).
49
-
50
- * Update to work with libxml-ruby 2.1.0 and higher (Jens Willie).
51
-
52
- * Use ENV for rake compiler task configuration (Jens Willie)
53
-
54
- * Build fixes (Charlie Savage).
55
-
56
- * Switch to using def files to control library exports (Charlie Savage).
57
-
58
-
59
- == 1.0.1 / 2011-04-18 Charlie Savage
60
-
61
- * Modernize gem - add gemspec file, use rake-compiler
62
-
63
- * Fix Ruby 1.9.2 compile errors
64
-
65
- * Build fixes
66
-
67
- * Update tests scripts to make testing during development easier
68
-
69
-
70
- == 0.9.8 / 2011-01-18 Charlie Savage
71
-
72
- * Update build environment
73
-
74
-
75
- == 0.9.1 / 2008-11-24 Charlie Savage
76
-
77
- * Support libxml-ruby bindings 0.9.3 and above which has a changed
78
- external api.
79
-
80
- * Remove unused xslt transform wrapper class.
81
-
82
- == 0.9.0 / 2008-11-18 Charlie Savage
83
-
84
- * Add back in support for exslt.
85
-
86
- * Support libxml-ruby bindings 0.9.0.
87
-
88
- == 0.8.2 / 2008-07-21 Charlie Savage
89
-
90
- * To use LibXSLT you can either require 'xslt' or require 'libxslt'.
91
- The differences is that require 'xslt' mixes the LibXML and
92
- LIBXSLT modules into the global namespace, thereby allowing
93
- you to write code such as:
94
- stylesheet = XSLT::Stylesheet.new(XML::Document.new). Note that
95
- this is different from 0.8.0 release and may require updating your code.
96
-
97
- * Support for libxml-ruby 0.8.2
98
-
99
- * Improved Windows support - libxslt-ruby should now work out of the box.
100
-
101
- == 0.8.0 / 2008-07-10 Charlie Savage
102
-
103
- * Fix memory errors when reusing a stylehseet
104
-
105
- * Added support for setting xsl::param values
106
-
107
- * Updated RDocs.
108
-
109
- * Moved to LibXSLT namespace
110
-
111
-
112
- == 0.7.0 / 2008-07-10 Charlie Savage
113
-
114
- * Ability to reuse the same stylesheet multiple times
115
-
116
- * Simpler api
117
-
118
- * Compatibility layer for pre-0.7.0 versions
119
-
120
- * Major rewrite, resulting in significantly less code
121
-
122
- * Updated RDocs.
123
-
124
-
125
- == 0.6.0 / 2008-07-01 Charlie Savage
126
-
127
- * Now packaged as a separate gem
128
-
129
- * Windows support (both lots of memory fixes and binaries)
130
-
131
- * New libxslt.rb ruby wrapper, so programs can simply say require 'xslt'
132
-
133
-
134
- == 0.5.0 / 2006-02-27 Ross Bamford <rosco at roscopeco.co.uk>
135
-
136
- * Source layout for Rubygem release
137
-
138
- * Fixed unit tests (set_up to setup, directory handling)
139
-
140
- * Updated extconf to remove shell-script dependency
141
-
142
- * Fixed multiple symbol declarations for -fno-common
143
-
144
- == 0.4.0 / 2003-12-15 Martin Povolny <martin@solnet.cz>
145
-
146
- * libxslt.c: added call to exsltRegisterAll to enable exslt extensions
147
-
148
- * extconf.rb: added -lexslt
149
-
150
- == 0.3.0 / 2004-02-01 Martin Povolny <martin@solnet.cz>
151
-
152
- * libxslt.c: added call to ruby_init_xslt_transform_context() to make it
153
- work on ruby1.8
154
-
1
+ == 1.2.0 / 2020-05-19 Charlie Savage
2
+
3
+ * Remove deprecated functions (Charlie Savage)
4
+ * Remove reference to unsupported constant that was removed from libxslt (Isabel Drost-Fromm)
5
+ * Modernize tests (Charlie Savage)
6
+ * Add travis.yml (Sophia Shao)
7
+
8
+ == 1.1.1 / 2014-03-16 Charlie Savage
9
+
10
+ * Adds output and transform methods that respect the <xsl:output> options in stylesheets (Rick Frankel)
11
+ * Update included binaries
12
+ * Update extconf.rb to remove warnings
13
+
14
+ == 1.1.0 / 2013-01-06 Charlie Savage
15
+
16
+ * Update dependency to latest libxml-ruby version (Charlie Savage)
17
+ * Remove dependency on dl which causes warning in Ruby 2.0.0 (Charlie Savage)
18
+
19
+ == 1.0.9 / 2012-03-17 Charlie Savage
20
+
21
+ * Build fix for library inclusion order (Andrew Watts)
22
+ * Add pkg directory to gitignore (Travis Warlick)
23
+
24
+ == 1.0.8 / 2011-09-03 Charlie Savage
25
+
26
+ * Don't depend on exported data from libxml-ruby, doesn't work with VC++.
27
+
28
+ == 1.0.7 / 2011-08-29 Charlie Savage
29
+
30
+ * Don't require 'rake' in the gemspec to avoid annoying Bundler bugs
31
+
32
+ == 1.0.6 / 2011-08-14
33
+
34
+ * Fix compilation with Microsoft Visual Studio 2010 (Charlie Savage)
35
+
36
+
37
+ == 1.0.5 / 2011-08-09
38
+
39
+ * Fix Ruby 1.9.3-preview1 libxml 2.7.3 (OS X Lion) conflicting OnigUChar redefinition (Travis Warlick).
40
+
41
+
42
+ == 1.0.4 / 2011-08-03
43
+
44
+ * Don't link against libxml-ruby on OS X, as it is unnecessary and doesn't work
45
+ - dylib vs bundle (Travis Warlick).
46
+
47
+ * Add 'rake' to gemspec to enable use of :path option with Bundler (Travis Warlick).
48
+
49
+ * Update test requires to work on Ruby 1.8.* and 1.9.* (Charlie Savage)
50
+
51
+
52
+ == 1.0.3 / 2011-07-31
53
+
54
+ * Added support for extension function registration. This was adapted from
55
+ Gregoire Lejeune's ruby-xslt library at https://github.com/glejeune/ruby-xslt (Jens Willie).
56
+
57
+ * Update to work with libxml-ruby 2.1.0 and higher (Jens Willie).
58
+
59
+ * Use ENV for rake compiler task configuration (Jens Willie)
60
+
61
+ * Build fixes (Charlie Savage).
62
+
63
+ * Switch to using def files to control library exports (Charlie Savage).
64
+
65
+
66
+ == 1.0.1 / 2011-04-18 Charlie Savage
67
+
68
+ * Modernize gem - add gemspec file, use rake-compiler
69
+
70
+ * Fix Ruby 1.9.2 compile errors
71
+
72
+ * Build fixes
73
+
74
+ * Update tests scripts to make testing during development easier
75
+
76
+
77
+ == 0.9.8 / 2011-01-18 Charlie Savage
78
+
79
+ * Update build environment
80
+
81
+
82
+ == 0.9.1 / 2008-11-24 Charlie Savage
83
+
84
+ * Support libxml-ruby bindings 0.9.3 and above which has a changed
85
+ external api.
86
+
87
+ * Remove unused xslt transform wrapper class.
88
+
89
+ == 0.9.0 / 2008-11-18 Charlie Savage
90
+
91
+ * Add back in support for exslt.
92
+
93
+ * Support libxml-ruby bindings 0.9.0.
94
+
95
+ == 0.8.2 / 2008-07-21 Charlie Savage
96
+
97
+ * To use LibXSLT you can either require 'xslt' or require 'libxslt'.
98
+ The differences is that require 'xslt' mixes the LibXML and
99
+ LIBXSLT modules into the global namespace, thereby allowing
100
+ you to write code such as:
101
+ stylesheet = XSLT::Stylesheet.new(XML::Document.new). Note that
102
+ this is different from 0.8.0 release and may require updating your code.
103
+
104
+ * Support for libxml-ruby 0.8.2
105
+
106
+ * Improved Windows support - libxslt-ruby should now work out of the box.
107
+
108
+ == 0.8.0 / 2008-07-10 Charlie Savage
109
+
110
+ * Fix memory errors when reusing a stylehseet
111
+
112
+ * Added support for setting xsl::param values
113
+
114
+ * Updated RDocs.
115
+
116
+ * Moved to LibXSLT namespace
117
+
118
+
119
+ == 0.7.0 / 2008-07-10 Charlie Savage
120
+
121
+ * Ability to reuse the same stylesheet multiple times
122
+
123
+ * Simpler api
124
+
125
+ * Compatibility layer for pre-0.7.0 versions
126
+
127
+ * Major rewrite, resulting in significantly less code
128
+
129
+ * Updated RDocs.
130
+
131
+
132
+ == 0.6.0 / 2008-07-01 Charlie Savage
133
+
134
+ * Now packaged as a separate gem
135
+
136
+ * Windows support (both lots of memory fixes and binaries)
137
+
138
+ * New libxslt.rb ruby wrapper, so programs can simply say require 'xslt'
139
+
140
+
141
+ == 0.5.0 / 2006-02-27 Ross Bamford <rosco at roscopeco.co.uk>
142
+
143
+ * Source layout for Rubygem release
144
+
145
+ * Fixed unit tests (set_up to setup, directory handling)
146
+
147
+ * Updated extconf to remove shell-script dependency
148
+
149
+ * Fixed multiple symbol declarations for -fno-common
150
+
151
+ == 0.4.0 / 2003-12-15 Martin Povolny <martin@solnet.cz>
152
+
153
+ * libxslt.c: added call to exsltRegisterAll to enable exslt extensions
154
+
155
+ * extconf.rb: added -lexslt
156
+
157
+ == 0.3.0 / 2004-02-01 Martin Povolny <martin@solnet.cz>
158
+
159
+ * libxslt.c: added call to ruby_init_xslt_transform_context() to make it
160
+ work on ruby1.8
161
+
data/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- # $Id$
2
-
3
- Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
- of the Software, and to permit persons to whom the Software is furnished to do
10
- so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ # $Id$
2
+
3
+ Copyright (c) 2002-2006 Sean Chittenden <sean@chittenden.org> and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,160 +1,170 @@
1
- = libxslt-ruby
2
-
3
- == Overview
4
-
5
- The libxslt gem provides Ruby language bindings for GNOME's Libxslt
6
- toolkit. It is free software, released under the MIT License.
7
-
8
-
9
- == Requirements
10
-
11
- libxslt-ruby requires Ruby 1.8.4 or higher. It is dependent on
12
- the following libraries to function properly:
13
-
14
- * libm (math routines: very standard)
15
- * libz (zlib)
16
- * libiconv
17
- * libxml2
18
- * libxslt
19
- * libxml-ruby bindings
20
-
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.
24
-
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.
31
-
32
-
33
- == INSTALLATION
34
-
35
- The easiest way to install libxslt-ruby is via Ruby Gems. To install:
36
-
37
- <tt>gem install libxslt-ruby</tt>
38
-
39
- If you are running Windows, make sure to install the Mingw64 RubyGem which
40
- includes an already built binary file. The binary is built against
41
- libxml2 version 2.9.1, iconv version 1.14 and libxslt version 1.1.28.
42
- Binaries for libxml2 and iconv are provided in the libxml-ruby bindings,
43
- while binaries for libxslt and libexslt areprovided in the
44
- libxslt-ruby bindings.
45
-
46
-
47
- == USAGE
48
-
49
- For in-depth information about using libxslt-ruby please refer
50
- to its online Rdoc documentation.
51
-
52
- All libxslt classes are in the LibXSLT::XSLT module. The simplest
53
- way to use libxslt is to require 'xslt'. This will mixin the
54
- LibXML and LibXSLT modules into the global namespace, allowing you to
55
- write code like this:
56
-
57
- require 'xslt'
58
- document = XML::Document.new
59
- stylesheett = XSLT::Stylesheet.new(document)
60
-
61
- If you prefer not to add the LibXSLT module to the global namepace, then
62
- write your code like this:
63
-
64
- require 'libxslt'
65
-
66
- class MyClass
67
- def some_method
68
- document = LibXML::XML::Document.new
69
- stylesheett = LibXSLT::XSLT::Stylesheet.new(document)
70
- end
71
- end
72
-
73
- Given an XML file like:
74
-
75
- <?xml version="1.0" encoding="UTF-8"?>
76
- <?xml-stylesheet href="fuzface.xsl" type="text/xsl"?>
77
-
78
- <commentary>
79
- <meta>
80
- <author>
81
- <first_name>Sean</first_name>
82
- <last_name>Chittenden</last_name>
83
- <email>sean@chittenden.org</email>
84
- </author>
85
- <version>$Version$</version>
86
- <date>$Date$</date>
87
- <id>$Id$</id> <title>Fuzface...</title>
88
- <subtitle>The Internet's a big place and here's some proof...</subtitle>
89
- </meta>
90
-
91
- <body>
92
- <para>
93
- I think it's a tragedy that I'm going to start off my new
94
- commentary by talking about facial hair and the Internet.
95
- Something about that just screams pathetic, but whatever: it's
96
- humor and that's life.
97
- </para>
98
- </body>
99
- </commentary>
100
-
101
- And an XSLT file like this:
102
-
103
- <?xml version="1.0" ?>
104
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
105
- <xsl:template match="/">
106
- <xsl:element name="html">
107
- <xsl:element name="head">
108
- <xsl:element name="title">Ramblings - <xsl:value-of select="commentary/meta/title" /> - <xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
109
- </xsl:element>
110
-
111
- <xsl:element name="body">
112
- <xsl:element name="h1"><xsl:value-of select="commentary/meta/title" /></xsl:element>
113
- <xsl:element name="h3"><xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
114
- By: <xsl:value-of select="commentary/meta/author/first_name" /> <xsl:value-of select="commentary/meta/author/last_name" /><xsl:element name="br" />
115
- Date: <xsl:value-of select="commentary/meta/date" /><xsl:element name="br" />
116
-
117
- <xsl:for-each select="./commentary/body">
118
- <xsl:apply-templates />
119
- </xsl:for-each>
120
-
121
- </xsl:element>
122
- </xsl:element>
123
- </xsl:template>
124
-
125
- <xsl:template match="para">
126
- <xsl:element name="p">
127
- <xsl:value-of select="." />
128
- </xsl:element>
129
- </xsl:template>
130
- </xsl:stylesheet>
131
-
132
- We can easily transform the XML with the following ruby code:
133
-
134
- require 'xslt'
135
-
136
- # Create a new XSL Transform
137
- stylesheet_doc = XML::Document.file('files/fuzface.xsl')
138
- stylesheet = LibXSLT::Stylesheet.new(stylesheet_doc)
139
-
140
- # Transform a xml document
141
- xml_doc = XML::Document.file('files/fuzface.xml')
142
- result = stylesheet.apply(xml_doc)
143
-
144
- You can then print, save or manipulate the returned document.
145
-
146
- == License
147
-
148
- See LICENSE for license information.
149
-
150
- == DOCUMENTATION
151
-
152
- RDoc comments are included - run 'rake doc' to generate documentation.
153
- You can find the latest documentation at:
154
-
155
- * http://libxsl.rubyforge.org/
156
-
157
- == MORE INFORMATION
158
-
159
- For more information please refer to the documentation. If you have any
160
- questions, please send email to libxml-devel@rubyforge.org.
1
+ = libxslt-ruby
2
+
3
+ == Overview
4
+
5
+ The libxslt gem provides Ruby language bindings for GNOME's Libxslt
6
+ toolkit. It is free software, released under the MIT License.
7
+
8
+
9
+ == Requirements
10
+
11
+ libxslt-ruby requires Ruby 1.8.4 or higher. It is dependent on
12
+ the following libraries to function properly:
13
+
14
+ * libm (math routines: very standard)
15
+ * libz (zlib)
16
+ * libiconv
17
+ * libxml2
18
+ * libxslt
19
+ * libxml-ruby bindings
20
+
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.
24
+
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.
31
+
32
+
33
+ == INSTALLATION
34
+
35
+ The easiest way to install libxslt-ruby is via Ruby Gems. To install:
36
+
37
+ <tt>gem install libxslt-ruby</tt>
38
+
39
+ If you are running Windows, make sure to install the Mingw64 RubyGem which
40
+ includes an already built binary file. The binary is built against
41
+ libxml2 version 2.9.1, iconv version 1.14 and libxslt version 1.1.28.
42
+ Binaries for libxml2 and iconv are provided in the libxml-ruby bindings,
43
+ while binaries for libxslt and libexslt areprovided in the
44
+ libxslt-ruby bindings.
45
+
46
+
47
+ Installation from source:
48
+
49
+ ruby ext/libxslt/extconf.rb
50
+ make
51
+ sudo make install
52
+
53
+ gem build libxslt-ruby.gemspec
54
+ gem install libxslt-ruby-1.1.1.gem
55
+
56
+
57
+ == USAGE
58
+
59
+ For in-depth information about using libxslt-ruby please refer
60
+ to its online Rdoc documentation.
61
+
62
+ All libxslt classes are in the LibXSLT::XSLT module. The simplest
63
+ way to use libxslt is to require 'xslt'. This will mixin the
64
+ LibXML and LibXSLT modules into the global namespace, allowing you to
65
+ write code like this:
66
+
67
+ require 'xslt'
68
+ document = XML::Document.new
69
+ stylesheett = XSLT::Stylesheet.new(document)
70
+
71
+ If you prefer not to add the LibXSLT module to the global namepace, then
72
+ write your code like this:
73
+
74
+ require 'libxslt'
75
+
76
+ class MyClass
77
+ def some_method
78
+ document = LibXML::XML::Document.new
79
+ stylesheett = LibXSLT::XSLT::Stylesheet.new(document)
80
+ end
81
+ end
82
+
83
+ Given an XML file like:
84
+
85
+ <?xml version="1.0" encoding="UTF-8"?>
86
+ <?xml-stylesheet href="fuzface.xsl" type="text/xsl"?>
87
+
88
+ <commentary>
89
+ <meta>
90
+ <author>
91
+ <first_name>Sean</first_name>
92
+ <last_name>Chittenden</last_name>
93
+ <email>sean@chittenden.org</email>
94
+ </author>
95
+ <version>$Version$</version>
96
+ <date>$Date$</date>
97
+ <id>$Id$</id> <title>Fuzface...</title>
98
+ <subtitle>The Internet's a big place and here's some proof...</subtitle>
99
+ </meta>
100
+
101
+ <body>
102
+ <para>
103
+ I think it's a tragedy that I'm going to start off my new
104
+ commentary by talking about facial hair and the Internet.
105
+ Something about that just screams pathetic, but whatever: it's
106
+ humor and that's life.
107
+ </para>
108
+ </body>
109
+ </commentary>
110
+
111
+ And an XSLT file like this:
112
+
113
+ <?xml version="1.0" ?>
114
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
115
+ <xsl:template match="/">
116
+ <xsl:element name="html">
117
+ <xsl:element name="head">
118
+ <xsl:element name="title">Ramblings - <xsl:value-of select="commentary/meta/title" /> - <xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
119
+ </xsl:element>
120
+
121
+ <xsl:element name="body">
122
+ <xsl:element name="h1"><xsl:value-of select="commentary/meta/title" /></xsl:element>
123
+ <xsl:element name="h3"><xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
124
+ By: <xsl:value-of select="commentary/meta/author/first_name" /> <xsl:value-of select="commentary/meta/author/last_name" /><xsl:element name="br" />
125
+ Date: <xsl:value-of select="commentary/meta/date" /><xsl:element name="br" />
126
+
127
+ <xsl:for-each select="./commentary/body">
128
+ <xsl:apply-templates />
129
+ </xsl:for-each>
130
+
131
+ </xsl:element>
132
+ </xsl:element>
133
+ </xsl:template>
134
+
135
+ <xsl:template match="para">
136
+ <xsl:element name="p">
137
+ <xsl:value-of select="." />
138
+ </xsl:element>
139
+ </xsl:template>
140
+ </xsl:stylesheet>
141
+
142
+ We can easily transform the XML with the following ruby code:
143
+
144
+ require 'xslt'
145
+
146
+ # Create a new XSL Transform
147
+ stylesheet_doc = XML::Document.file('files/fuzface.xsl')
148
+ stylesheet = LibXSLT::Stylesheet.new(stylesheet_doc)
149
+
150
+ # Transform a xml document
151
+ xml_doc = XML::Document.file('files/fuzface.xml')
152
+ result = stylesheet.apply(xml_doc)
153
+
154
+ You can then print, save or manipulate the returned document.
155
+
156
+ == License
157
+
158
+ See LICENSE for license information.
159
+
160
+ == DOCUMENTATION
161
+
162
+ RDoc comments are included - run 'rake doc' to generate documentation.
163
+ You can find the latest documentation at:
164
+
165
+ * http://libxsl.rubyforge.org/
166
+
167
+ == MORE INFORMATION
168
+
169
+ For more information please refer to the documentation. If you have any
170
+ questions, please send email to libxml-devel@rubyforge.org.