ruby-xslt 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +24 -0
- data/AUTHORS +3 -0
- data/ChangeLog +4 -0
- data/README.rdoc +124 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/ext/xslt_lib/extconf.rb +4 -0
- data/ext/xslt_lib/extfunc.c +1 -1
- data/ext/xslt_lib/parameters.c +3 -3
- data/ext/xslt_lib/rb_utils.h +5 -1
- data/ext/xslt_lib/xslt.h +7 -3
- data/ext/xslt_lib/xslt_lib.c +2 -2
- data/ruby-xslt.gemspec +77 -0
- metadata +66 -36
- data/README +0 -132
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
## MAC OS
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
## TEXTMATE
|
5
|
+
*.tmproj
|
6
|
+
tmtags
|
7
|
+
|
8
|
+
## EMACS
|
9
|
+
*~
|
10
|
+
\#*
|
11
|
+
.\#*
|
12
|
+
|
13
|
+
## VIM
|
14
|
+
*.swp
|
15
|
+
|
16
|
+
## PROJECT::GENERAL
|
17
|
+
coverage
|
18
|
+
rdoc
|
19
|
+
pkg
|
20
|
+
|
21
|
+
## PROJECT::SPECIFIC
|
22
|
+
ext/xslt_lib/Makefile
|
23
|
+
ext/xslt_lib/mkmf.log
|
24
|
+
examples
|
data/AUTHORS
CHANGED
data/ChangeLog
CHANGED
data/README.rdoc
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
= Ruby/XSLT
|
2
|
+
|
3
|
+
== About
|
4
|
+
|
5
|
+
Ruby/XSLT is a simple XSLT class based on libxml <http://xmlsoft.org/> and libxslt <http://xmlsoft.org/XSLT/>
|
6
|
+
|
7
|
+
== Licence
|
8
|
+
|
9
|
+
Copyright (C) 2003-2010 Gregoire Lejeune <gregoire dot lejeune at free dot fr>
|
10
|
+
|
11
|
+
Ruby/XSLT is freely distributable according to the terms of the
|
12
|
+
GNU General Public License (see the file 'COPYING').
|
13
|
+
|
14
|
+
This program is distributed without any warranty. See the file
|
15
|
+
'COPYING' for details.
|
16
|
+
|
17
|
+
== INSTALLATION
|
18
|
+
|
19
|
+
sudo gem install ruby-xslt
|
20
|
+
|
21
|
+
or
|
22
|
+
|
23
|
+
ruby extconf.rb # see CONFIGURATION for more options
|
24
|
+
make
|
25
|
+
make test
|
26
|
+
make doc
|
27
|
+
sudo make install
|
28
|
+
|
29
|
+
=== CONFIGURATION
|
30
|
+
|
31
|
+
--help display this help and exit
|
32
|
+
|
33
|
+
--with-xslt-lib=PATH
|
34
|
+
--with-xslt-include=PATH
|
35
|
+
--with-xslt-dir=PATH specify the directory name for the libxslt include
|
36
|
+
files and/or library
|
37
|
+
|
38
|
+
--disable-error-handler disables the new error handler
|
39
|
+
|
40
|
+
--disable-exslt disables libexslt support <http://exslt.org/>
|
41
|
+
|
42
|
+
|
43
|
+
== EXAMPLES
|
44
|
+
|
45
|
+
=== Simple example
|
46
|
+
require 'xml/xslt'
|
47
|
+
|
48
|
+
xslt = XML::XSLT.new()
|
49
|
+
xslt.xml = "text.xml"
|
50
|
+
xslt.xsl = "test.xsl"
|
51
|
+
|
52
|
+
out = xslt.serve()
|
53
|
+
print out;
|
54
|
+
|
55
|
+
=== REXML support
|
56
|
+
require 'rexml/document'
|
57
|
+
require 'xml/xslt'
|
58
|
+
|
59
|
+
xslt = XML::XSLT.new()
|
60
|
+
|
61
|
+
xslt.xml = REXML::Document.new File.read( "test.xml" )
|
62
|
+
xslt.xsl = REXML::Document.new File.read( "test.xsl" )
|
63
|
+
|
64
|
+
out = xslt.serve()
|
65
|
+
print out;
|
66
|
+
|
67
|
+
=== XML::Smart support
|
68
|
+
require 'xml/smart'
|
69
|
+
require 'xml/xslt'
|
70
|
+
|
71
|
+
xslt = XML::XSLT.new()
|
72
|
+
|
73
|
+
xslt.xml = XML::Smart.open( "test.xml" )
|
74
|
+
xslt.xsl = XML::Smart.open( "test.xsl" )
|
75
|
+
|
76
|
+
out = xslt.serve()
|
77
|
+
print out;
|
78
|
+
|
79
|
+
=== Parameters support
|
80
|
+
require "xml/xslt"
|
81
|
+
|
82
|
+
xslt = XML::XSLT.new()
|
83
|
+
xslt.xsl = "parameter.xsl"
|
84
|
+
xslt.xml = "test.xml"
|
85
|
+
xslt.parameters = { "p1" => "the first parameter ...",
|
86
|
+
"p2" => "'and the second one!'" }
|
87
|
+
xslt.save("test1.html")
|
88
|
+
|
89
|
+
xslt.parameters = { "p1" => "Ruby...",
|
90
|
+
"p2" => "'...is cool !'" }
|
91
|
+
xslt.save("test2.html")
|
92
|
+
|
93
|
+
=== External functions support
|
94
|
+
require "xml/xslt"
|
95
|
+
|
96
|
+
xslt = XML::XSLT.new()
|
97
|
+
xslt.xsl = "functions.xsl"
|
98
|
+
xslt.xml = "test.xml"
|
99
|
+
|
100
|
+
XML::XSLT.registerExtFunc("http://test.none", "round-trip") do |arg|
|
101
|
+
arg
|
102
|
+
end
|
103
|
+
|
104
|
+
XML::XSLT.registerExtFunc("http://test.none", "type") do |arg|
|
105
|
+
arg.class.to_s
|
106
|
+
end
|
107
|
+
|
108
|
+
print xslt.serve
|
109
|
+
|
110
|
+
=== Error handling
|
111
|
+
|
112
|
+
XML::XSLT.registerErrorHandler { |string| puts string }
|
113
|
+
|
114
|
+
xslt = XML::XSLT.new
|
115
|
+
xslt.xml = "not xml"
|
116
|
+
|
117
|
+
This fragment would print:
|
118
|
+
|
119
|
+
Entity: line 1:
|
120
|
+
parser
|
121
|
+
error :
|
122
|
+
Start Tag expected, '<' not found
|
123
|
+
not xml
|
124
|
+
^
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "ruby-xslt"
|
8
|
+
gem.summary = %Q{Ruby/XSLT is a simple XSLT class based on libxml <http://xmlsoft.org/> and libxslt <http://xmlsoft.org/XSLT/> }
|
9
|
+
gem.description = gem.summary
|
10
|
+
gem.email = "gregoire.lejeune@free.fr"
|
11
|
+
gem.homepage = "http://github.com/glejeune/ruby-xslt"
|
12
|
+
gem.authors = ["Gregoire Lejeune"]
|
13
|
+
gem.extensions = FileList["ext/**/extconf.rb"].to_a
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'rake/testtask'
|
21
|
+
Rake::TestTask.new(:test) do |test|
|
22
|
+
test.libs << 'lib' << 'test'
|
23
|
+
test.pattern = 'test/**/test_*.rb'
|
24
|
+
test.verbose = true
|
25
|
+
end
|
26
|
+
|
27
|
+
begin
|
28
|
+
require 'rcov/rcovtask'
|
29
|
+
Rcov::RcovTask.new do |test|
|
30
|
+
test.libs << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
rescue LoadError
|
35
|
+
task :rcov do
|
36
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task :test => :check_dependencies
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rake/rdoctask'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "syncftp #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.7
|
data/ext/xslt_lib/extconf.rb
CHANGED
@@ -45,6 +45,10 @@ dir_config( 'xslt' )
|
|
45
45
|
have_library "xml2", "xmlParseDoc" || crash("need libxml2")
|
46
46
|
have_library "xslt", "xsltParseStylesheetFile" || crash("need libxslt")
|
47
47
|
|
48
|
+
if /^1.8/.match RUBY_VERSION
|
49
|
+
$CFLAGS += " -DRUBY_1_8"
|
50
|
+
end
|
51
|
+
|
48
52
|
if enable_config("exslt", true)
|
49
53
|
have_library "exslt", "exsltRegisterAll"
|
50
54
|
$CFLAGS += " -DUSE_EXSLT"
|
data/ext/xslt_lib/extfunc.c
CHANGED
@@ -138,7 +138,7 @@ xmlXPathObjectPtr value2xpathObj (VALUE val) {
|
|
138
138
|
int i,j;
|
139
139
|
ret = xmlXPathNewNodeSet(NULL);
|
140
140
|
|
141
|
-
for(i =
|
141
|
+
for(i = RARRAY_LEN(val); i > 0; i--) {
|
142
142
|
xmlXPathObjectPtr obj = value2xpathObj( rb_ary_shift( val ) );
|
143
143
|
if ((obj->nodesetval != NULL) && (obj->nodesetval->nodeNr != 0)) {
|
144
144
|
for(j = 0; j < obj->nodesetval->nodeNr; j++) {
|
data/ext/xslt_lib/parameters.c
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
/**
|
22
22
|
* parameters support, patch from :
|
23
23
|
*
|
24
|
-
*
|
24
|
+
* Eustáquio "TaQ" Rangel
|
25
25
|
* eustaquiorangel@yahoo.com
|
26
26
|
* http://beam.to/taq
|
27
27
|
*
|
@@ -39,8 +39,8 @@ VALUE process_pair( VALUE pair, VALUE rbparams ) {
|
|
39
39
|
|
40
40
|
Check_Type( pair, T_ARRAY );
|
41
41
|
|
42
|
-
key =
|
43
|
-
value =
|
42
|
+
key = RARRAY_PTR(pair)[0];
|
43
|
+
value = rb_obj_clone( RARRAY_PTR(pair)[1] );
|
44
44
|
|
45
45
|
Check_Type( key, T_STRING );
|
46
46
|
Check_Type( value, T_STRING );
|
data/ext/xslt_lib/rb_utils.h
CHANGED
data/ext/xslt_lib/xslt.h
CHANGED
@@ -22,7 +22,11 @@
|
|
22
22
|
#define __RUBY_XSLT_H__
|
23
23
|
|
24
24
|
#include <ruby.h>
|
25
|
-
#
|
25
|
+
#ifdef RUBY_1_8
|
26
|
+
#include <rubyio.h>
|
27
|
+
#else
|
28
|
+
#include <ruby/io.h>
|
29
|
+
#endif
|
26
30
|
|
27
31
|
#include <string.h>
|
28
32
|
|
@@ -53,8 +57,8 @@
|
|
53
57
|
#include "parameters.h"
|
54
58
|
#include "extfunc.h"
|
55
59
|
|
56
|
-
#define RUBY_XSLT_VERSION "0.9.
|
57
|
-
#define RUBY_XSLT_VERNUM
|
60
|
+
#define RUBY_XSLT_VERSION "0.9.7"
|
61
|
+
#define RUBY_XSLT_VERNUM 097
|
58
62
|
|
59
63
|
#define RUBY_XSLT_XSLSRC_TYPE_NULL 0
|
60
64
|
#define RUBY_XSLT_XSLSRC_TYPE_STR 1
|
data/ext/xslt_lib/xslt_lib.c
CHANGED
@@ -501,7 +501,7 @@ VALUE ruby_xslt_to_s( VALUE self ) {
|
|
501
501
|
if (vXSLTSheet == NULL) return Qnil;
|
502
502
|
|
503
503
|
vStrOut = rb_str_new( 0, strlen(xKlassName)+1024 );
|
504
|
-
(void) sprintf(
|
504
|
+
(void) sprintf( RSTRING_PTR(vStrOut),
|
505
505
|
"#<%s: parent=%p,next=%p,imports=%p,docList=%p,"
|
506
506
|
"doc=%p,stripSpaces=%p,stripAll=%d,cdataSection=%p,"
|
507
507
|
"variables=%p,templates=%p,templatesHash=%p,"
|
@@ -530,7 +530,7 @@ VALUE ruby_xslt_to_s( VALUE self ) {
|
|
530
530
|
vXSLTSheet->exclPrefix, vXSLTSheet->exclPrefixTab, vXSLTSheet->exclPrefixNr,
|
531
531
|
vXSLTSheet->exclPrefixMax );
|
532
532
|
|
533
|
-
|
533
|
+
vStrOut = strlen(RSTRING_PTR(vStrOut));
|
534
534
|
if( OBJ_TAINTED(self) ) OBJ_TAINT(vStrOut);
|
535
535
|
|
536
536
|
// xsltFreeStylesheet(vXSLTSheet);
|
data/ruby-xslt.gemspec
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ruby-xslt}
|
8
|
+
s.version = "0.9.7"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Gregoire Lejeune"]
|
12
|
+
s.date = %q{2010-06-28}
|
13
|
+
s.description = %q{Ruby/XSLT is a simple XSLT class based on libxml <http://xmlsoft.org/> and libxslt <http://xmlsoft.org/XSLT/>}
|
14
|
+
s.email = %q{gregoire.lejeune@free.fr}
|
15
|
+
s.extensions = ["ext/xslt_lib/extconf.rb"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"ChangeLog",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
"AUTHORS",
|
23
|
+
"COPYING",
|
24
|
+
"ChangeLog",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"ext/xslt_lib/extconf.rb",
|
29
|
+
"ext/xslt_lib/extfunc.c",
|
30
|
+
"ext/xslt_lib/extfunc.h",
|
31
|
+
"ext/xslt_lib/parameters.c",
|
32
|
+
"ext/xslt_lib/parameters.h",
|
33
|
+
"ext/xslt_lib/parser.c",
|
34
|
+
"ext/xslt_lib/parser.h",
|
35
|
+
"ext/xslt_lib/rb_utils.c",
|
36
|
+
"ext/xslt_lib/rb_utils.h",
|
37
|
+
"ext/xslt_lib/xslt.h",
|
38
|
+
"ext/xslt_lib/xslt_lib.c",
|
39
|
+
"lib/xml/xslt.rb",
|
40
|
+
"ruby-xslt.gemspec",
|
41
|
+
"setup.rb",
|
42
|
+
"test/subdir/result.xsl",
|
43
|
+
"test/subdir/test.xsl",
|
44
|
+
"test/t.xml",
|
45
|
+
"test/t.xsl",
|
46
|
+
"test/test.rb"
|
47
|
+
]
|
48
|
+
s.homepage = %q{http://github.com/glejeune/ruby-xslt}
|
49
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
50
|
+
s.require_paths = ["lib"]
|
51
|
+
s.rubygems_version = %q{1.3.7}
|
52
|
+
s.summary = %q{Ruby/XSLT is a simple XSLT class based on libxml <http://xmlsoft.org/> and libxslt <http://xmlsoft.org/XSLT/>}
|
53
|
+
s.test_files = [
|
54
|
+
"test/test.rb",
|
55
|
+
"examples/bug.rb",
|
56
|
+
"examples/fuzface.rb",
|
57
|
+
"examples/fuzface_data.rb",
|
58
|
+
"examples/fuzface_error.rb",
|
59
|
+
"examples/fuzface_REXML.rb",
|
60
|
+
"examples/fuzface_to_s.rb",
|
61
|
+
"examples/fuzface_XML-Simple.rb",
|
62
|
+
"examples/info.rb",
|
63
|
+
"examples/test_functions.rb",
|
64
|
+
"examples/test_parameters.rb"
|
65
|
+
]
|
66
|
+
|
67
|
+
if s.respond_to? :specification_version then
|
68
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
69
|
+
s.specification_version = 3
|
70
|
+
|
71
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
72
|
+
else
|
73
|
+
end
|
74
|
+
else
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-xslt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 53
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 7
|
10
|
+
version: 0.9.7
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Gregoire Lejeune
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-06-28 00:00:00 +02:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -20,64 +26,88 @@ executables: []
|
|
20
26
|
extensions:
|
21
27
|
- ext/xslt_lib/extconf.rb
|
22
28
|
extra_rdoc_files:
|
23
|
-
- README
|
24
29
|
- ChangeLog
|
25
|
-
-
|
26
|
-
- AUTHORS
|
30
|
+
- README.rdoc
|
27
31
|
files:
|
28
|
-
-
|
29
|
-
- COPYING
|
30
|
-
- README
|
32
|
+
- .gitignore
|
31
33
|
- AUTHORS
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
-
|
39
|
-
- lib/xml
|
40
|
-
- lib/xml/xslt.rb
|
34
|
+
- COPYING
|
35
|
+
- ChangeLog
|
36
|
+
- README.rdoc
|
37
|
+
- Rakefile
|
38
|
+
- VERSION
|
39
|
+
- ext/xslt_lib/extconf.rb
|
40
|
+
- ext/xslt_lib/extfunc.c
|
41
41
|
- ext/xslt_lib/extfunc.h
|
42
|
+
- ext/xslt_lib/parameters.c
|
42
43
|
- ext/xslt_lib/parameters.h
|
44
|
+
- ext/xslt_lib/parser.c
|
43
45
|
- ext/xslt_lib/parser.h
|
46
|
+
- ext/xslt_lib/rb_utils.c
|
44
47
|
- ext/xslt_lib/rb_utils.h
|
45
48
|
- ext/xslt_lib/xslt.h
|
46
|
-
- ext/xslt_lib/extfunc.c
|
47
|
-
- ext/xslt_lib/parameters.c
|
48
|
-
- ext/xslt_lib/parser.c
|
49
|
-
- ext/xslt_lib/rb_utils.c
|
50
49
|
- ext/xslt_lib/xslt_lib.c
|
51
|
-
-
|
50
|
+
- lib/xml/xslt.rb
|
51
|
+
- ruby-xslt.gemspec
|
52
|
+
- setup.rb
|
53
|
+
- test/subdir/result.xsl
|
54
|
+
- test/subdir/test.xsl
|
55
|
+
- test/t.xml
|
56
|
+
- test/t.xsl
|
57
|
+
- test/test.rb
|
58
|
+
- examples/bug.rb
|
59
|
+
- examples/fuzface.rb
|
60
|
+
- examples/fuzface_data.rb
|
61
|
+
- examples/fuzface_error.rb
|
62
|
+
- examples/fuzface_REXML.rb
|
63
|
+
- examples/fuzface_to_s.rb
|
64
|
+
- examples/fuzface_XML-Simple.rb
|
65
|
+
- examples/info.rb
|
66
|
+
- examples/test_functions.rb
|
67
|
+
- examples/test_parameters.rb
|
52
68
|
has_rdoc: true
|
53
|
-
homepage: http://
|
69
|
+
homepage: http://github.com/glejeune/ruby-xslt
|
70
|
+
licenses: []
|
71
|
+
|
54
72
|
post_install_message:
|
55
73
|
rdoc_options:
|
56
|
-
- --
|
57
|
-
- Ruby/XSLT
|
58
|
-
- --main
|
59
|
-
- README
|
60
|
-
- --line-numbers
|
74
|
+
- --charset=UTF-8
|
61
75
|
require_paths:
|
62
76
|
- lib
|
63
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
64
79
|
requirements:
|
65
80
|
- - ">="
|
66
81
|
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
67
85
|
version: "0"
|
68
|
-
version:
|
69
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
70
88
|
requirements:
|
71
89
|
- - ">="
|
72
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 3
|
92
|
+
segments:
|
93
|
+
- 0
|
73
94
|
version: "0"
|
74
|
-
version:
|
75
95
|
requirements: []
|
76
96
|
|
77
|
-
rubyforge_project:
|
78
|
-
rubygems_version: 1.
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 1.3.7
|
79
99
|
signing_key:
|
80
|
-
specification_version:
|
81
|
-
summary:
|
82
|
-
test_files:
|
83
|
-
|
100
|
+
specification_version: 3
|
101
|
+
summary: Ruby/XSLT is a simple XSLT class based on libxml <http://xmlsoft.org/> and libxslt <http://xmlsoft.org/XSLT/>
|
102
|
+
test_files:
|
103
|
+
- test/test.rb
|
104
|
+
- examples/bug.rb
|
105
|
+
- examples/fuzface.rb
|
106
|
+
- examples/fuzface_data.rb
|
107
|
+
- examples/fuzface_error.rb
|
108
|
+
- examples/fuzface_REXML.rb
|
109
|
+
- examples/fuzface_to_s.rb
|
110
|
+
- examples/fuzface_XML-Simple.rb
|
111
|
+
- examples/info.rb
|
112
|
+
- examples/test_functions.rb
|
113
|
+
- examples/test_parameters.rb
|
data/README
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
= Ruby/XSLT
|
2
|
-
|
3
|
-
== About
|
4
|
-
|
5
|
-
Ruby/XSLT is a simple XSLT class based on libxml <http://xmlsoft.org/> and libxslt <http://xmlsoft.org/XSLT/>
|
6
|
-
|
7
|
-
== Licence
|
8
|
-
|
9
|
-
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Gregoire Lejeune <gregoire dot lejeune at free dot fr>
|
10
|
-
|
11
|
-
Ruby/XSLT is freely distributable according to the terms of the
|
12
|
-
GNU General Public License (see the file 'COPYING').
|
13
|
-
|
14
|
-
This program is distributed without any warranty. See the file
|
15
|
-
'COPYING' for details.
|
16
|
-
|
17
|
-
=== CVS access
|
18
|
-
The CVS repository is available at rubyforge.org[http://rubyforge.org/projects/ruby-asp]. You can browse[http://rubyforge.org/cgi-bin/viewcvs.cgi/ruby-xslt/?cvsroot=ruby-asp] it or access it via anonymous access :
|
19
|
-
|
20
|
-
cvs -d :pserver:anonymous@rubyforge.org:/var/cvs/ruby-asp login
|
21
|
-
cvs -d :pserver:anonymous@rubyforge.org:/var/cvs/ruby-asp checkout ruby-xslt
|
22
|
-
|
23
|
-
See this page[http://rubyforge.org/scm/?group_id=423] for more informations
|
24
|
-
|
25
|
-
== INSTALLATION
|
26
|
-
|
27
|
-
sudo gem install ruby-xslt
|
28
|
-
|
29
|
-
or
|
30
|
-
|
31
|
-
ruby extconf.rb # see CONFIGURATION for more options
|
32
|
-
make
|
33
|
-
make test
|
34
|
-
make doc
|
35
|
-
sudo make install
|
36
|
-
|
37
|
-
=== CONFIGURATION
|
38
|
-
|
39
|
-
--help display this help and exit
|
40
|
-
|
41
|
-
--with-xslt-lib=PATH
|
42
|
-
--with-xslt-include=PATH
|
43
|
-
--with-xslt-dir=PATH specify the directory name for the libxslt include
|
44
|
-
files and/or library
|
45
|
-
|
46
|
-
--disable-error-handler disables the new error handler
|
47
|
-
|
48
|
-
--disable-exslt disables libexslt support <http://exslt.org/>
|
49
|
-
|
50
|
-
|
51
|
-
== EXAMPLES
|
52
|
-
|
53
|
-
=== Simple example
|
54
|
-
require 'xml/xslt'
|
55
|
-
|
56
|
-
xslt = XML::XSLT.new()
|
57
|
-
xslt.xml = "text.xml"
|
58
|
-
xslt.xsl = "test.xsl"
|
59
|
-
|
60
|
-
out = xslt.serve()
|
61
|
-
print out;
|
62
|
-
|
63
|
-
=== REXML support
|
64
|
-
require 'rexml/document'
|
65
|
-
require 'xml/xslt'
|
66
|
-
|
67
|
-
xslt = XML::XSLT.new()
|
68
|
-
|
69
|
-
xslt.xml = REXML::Document.new File.read( "test.xml" )
|
70
|
-
xslt.xsl = REXML::Document.new File.read( "test.xsl" )
|
71
|
-
|
72
|
-
out = xslt.serve()
|
73
|
-
print out;
|
74
|
-
|
75
|
-
=== XML::Smart support
|
76
|
-
require 'xml/smart'
|
77
|
-
require 'xml/xslt'
|
78
|
-
|
79
|
-
xslt = XML::XSLT.new()
|
80
|
-
|
81
|
-
xslt.xml = XML::Smart.open( "test.xml" )
|
82
|
-
xslt.xsl = XML::Smart.open( "test.xsl" )
|
83
|
-
|
84
|
-
out = xslt.serve()
|
85
|
-
print out;
|
86
|
-
|
87
|
-
=== Parameters support
|
88
|
-
require "xml/xslt"
|
89
|
-
|
90
|
-
xslt = XML::XSLT.new()
|
91
|
-
xslt.xsl = "parameter.xsl"
|
92
|
-
xslt.xml = "test.xml"
|
93
|
-
xslt.parameters = { "p1" => "the first parameter ...",
|
94
|
-
"p2" => "'and the second one!'" }
|
95
|
-
xslt.save("test1.html")
|
96
|
-
|
97
|
-
xslt.parameters = { "p1" => "Ruby...",
|
98
|
-
"p2" => "'...is cool !'" }
|
99
|
-
xslt.save("test2.html")
|
100
|
-
|
101
|
-
=== External functions support
|
102
|
-
require "xml/xslt"
|
103
|
-
|
104
|
-
xslt = XML::XSLT.new()
|
105
|
-
xslt.xsl = "functions.xsl"
|
106
|
-
xslt.xml = "test.xml"
|
107
|
-
|
108
|
-
XML::XSLT.registerExtFunc("http://test.none", "round-trip") do |arg|
|
109
|
-
arg
|
110
|
-
end
|
111
|
-
|
112
|
-
XML::XSLT.registerExtFunc("http://test.none", "type") do |arg|
|
113
|
-
arg.class.to_s
|
114
|
-
end
|
115
|
-
|
116
|
-
print xslt.serve
|
117
|
-
|
118
|
-
=== Error handling
|
119
|
-
|
120
|
-
XML::XSLT.registerErrorHandler { |string| puts string }
|
121
|
-
|
122
|
-
xslt = XML::XSLT.new
|
123
|
-
xslt.xml = "not xml"
|
124
|
-
|
125
|
-
This fragment would print:
|
126
|
-
|
127
|
-
Entity: line 1:
|
128
|
-
parser
|
129
|
-
error :
|
130
|
-
Start Tag expected, '<' not found
|
131
|
-
not xml
|
132
|
-
^
|