libxslt-ruby 1.1.1-x64-mingw32 → 1.2.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES +161 -154
- data/LICENSE +21 -21
- data/README.rdoc +170 -160
- data/Rakefile +90 -90
- data/ext/libxslt/extconf.h +6 -0
- data/ext/libxslt/extconf.rb +112 -157
- data/ext/libxslt/libxslt.c +68 -69
- data/ext/libxslt/libxslt.h +37 -37
- data/ext/libxslt/ruby_exslt.c +149 -149
- data/ext/libxslt/ruby_exslt.h +8 -8
- data/ext/libxslt/ruby_xslt_stylesheet.c +302 -302
- data/ext/libxslt/ruby_xslt_stylesheet.h +10 -10
- data/ext/libxslt/version.h +5 -5
- data/ext/vc/libxslt_ruby.sln +12 -8
- data/ext/vc/libxslt_ruby.vcxproj +87 -3
- data/lib/2.7/libxslt_ruby.so +0 -0
- data/lib/libxslt-ruby.rb +14 -0
- data/lib/libxslt.rb +3 -16
- data/lib/libxslt/stylesheet.rb +32 -30
- data/lib/xslt.rb +15 -15
- data/libxslt-ruby.gemspec +45 -43
- data/setup.rb +1585 -1585
- data/test/files/commentary.dtd +34 -34
- data/test/files/fuzface.xml +154 -154
- data/test/files/fuzface.xsl +4 -4
- data/test/files/params.xml +2 -2
- data/test/files/params.xsl +10 -10
- data/test/files/ramblings.xsl +46 -46
- data/test/test_exslt.rb +69 -70
- data/test/test_helper.rb +5 -15
- data/test/test_libxslt.rb +20 -22
- data/test/test_stylesheet.rb +213 -214
- metadata +35 -11
- data/lib/2.1/libxslt_ruby.so +0 -0
- data/lib/libxslt/deprecated.rb +0 -68
- data/test/test_deprecated.rb +0 -100
- data/test/test_suite.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ec5c21f64f8a3898c1a18ccf04e4def7e8cc27d48ed1c5be5108143c327804bf
|
4
|
+
data.tar.gz: d5345b67ed9e4afd46cf196923cec804ea47079978bc727b897d879d258c79a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd0d751535b2095fc13b4945f5b33ef10a0c0fac32e8eba5b9e25cfc4720cc0da399bdef040d1c4e3006f02dbf0a56f43664ecb939545e8a208ba2e22b76c52
|
7
|
+
data.tar.gz: c7ad1703c6a7bc712b5b3c8dd1dca79921e7463b3c4136f165f1621b0e7dde308203799cd60cc395b624655dcb84055d45ace0f9abc4ad5e914aa0c05aaf198f
|
data/CHANGES
CHANGED
@@ -1,154 +1,161 @@
|
|
1
|
-
== 1.
|
2
|
-
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
*
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
*
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
*
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
*
|
62
|
-
|
63
|
-
*
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
*
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
== 0.9.
|
83
|
-
|
84
|
-
*
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
*
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
*
|
115
|
-
|
116
|
-
*
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
*
|
128
|
-
|
129
|
-
*
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
*
|
137
|
-
|
138
|
-
*
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
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.
|
data/README.rdoc
CHANGED
@@ -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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
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.
|