libxslt-ruby 0.8.2-x86-mswin32-60 → 0.9.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/Rakefile +16 -37
  2. data/ext/libxslt/libxslt.c +3 -0
  3. data/ext/libxslt/libxslt.h +1 -1
  4. data/ext/libxslt/ruby_xslt_stylesheet.c +6 -6
  5. data/ext/libxslt/version.h +3 -3
  6. data/ext/mingw/Rakefile +18 -32
  7. data/ext/mingw/libexslt-0.dll +0 -0
  8. data/ext/mingw/libxslt-1.dll +0 -0
  9. data/ext/mingw/libxslt_ruby.so +0 -0
  10. data/ext/vc/libxslt_ruby.vcproj +2 -2
  11. data/test/files/commentary.dtd +34 -0
  12. data/{lib/text.xml → test/files/fuzface.xml} +154 -129
  13. data/test/files/fuzface.xsl +4 -0
  14. data/test/files/params.xml +2 -0
  15. data/test/files/params.xsl +11 -0
  16. data/test/files/ramblings.xsl +46 -0
  17. data/test/test_deprecated.rb +97 -0
  18. data/test/test_libxslt.rb +21 -0
  19. data/test/test_stylesheet.rb +108 -0
  20. data/test/test_suite.rb +3 -0
  21. metadata +19 -37
  22. data/doc/classes/LibXSLT.html +0 -126
  23. data/doc/classes/LibXSLT/XSLT.html +0 -196
  24. data/doc/classes/LibXSLT/XSLT/Stylesheet.html +0 -250
  25. data/doc/classes/LibXSLT/XSLT/TransformContext.html +0 -117
  26. data/doc/classes/LibXSLT/XSLTError.html +0 -131
  27. data/doc/classes/XSLT.html +0 -125
  28. data/doc/created.rid +0 -1
  29. data/doc/files/CHANGES.html +0 -204
  30. data/doc/files/LICENSE.html +0 -133
  31. data/doc/files/README.html +0 -302
  32. data/doc/files/ext/libxslt/libxslt_c.html +0 -101
  33. data/doc/files/ext/libxslt/ruby_xslt_stylesheet_c.html +0 -101
  34. data/doc/files/ext/libxslt/ruby_xslt_transform_context_c.html +0 -101
  35. data/doc/files/lib/libxslt/deprecated_rb.html +0 -101
  36. data/doc/files/lib/libxslt_rb.html +0 -116
  37. data/doc/files/lib/xslt_rb.html +0 -135
  38. data/doc/fr_class_index.html +0 -32
  39. data/doc/fr_file_index.html +0 -35
  40. data/doc/fr_method_index.html +0 -28
  41. data/doc/index.html +0 -24
  42. data/doc/rdoc-style.css +0 -208
  43. data/lib/libxslt-1.dll +0 -0
  44. data/lib/libxslt_ruby.so +0 -0
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" ?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+ <xsl:include href="ramblings.xsl" />
4
+ </xsl:stylesheet>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <doc>abc</doc>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet version='1.0'
3
+ xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
4
+ xmlns:foo='http://example.com/foo'
5
+ exclude-result-prefixes='foo'>
6
+
7
+ <xsl:param name='bar'>failure</xsl:param>
8
+ <xsl:template match='/'>
9
+ <article><xsl:value-of select='$bar'/></article>
10
+ </xsl:template>
11
+ </xsl:stylesheet>
@@ -0,0 +1,46 @@
1
+ <?xml version="1.0" ?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+ <xsl:template match="/">
4
+ <xsl:element name="html">
5
+ <xsl:element name="head">
6
+ <xsl:element name="title">Ramblings - <xsl:value-of select="commentary/meta/title" /> - <xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
7
+ </xsl:element>
8
+
9
+ <xsl:element name="body">
10
+ <xsl:element name="h1"><xsl:value-of select="commentary/meta/title" /></xsl:element>
11
+ <xsl:element name="h3"><xsl:value-of select="commentary/meta/subtitle" /></xsl:element>
12
+ By: <xsl:value-of select="commentary/meta/author/first_name" /> <xsl:value-of select="commentary/meta/author/last_name" /><xsl:element name="br" />
13
+ Date: <xsl:value-of select="commentary/meta/date" /><xsl:element name="br" />
14
+
15
+ <xsl:for-each select="./commentary/body">
16
+ <xsl:apply-templates />
17
+ </xsl:for-each>
18
+
19
+ </xsl:element>
20
+ </xsl:element>
21
+ </xsl:template>
22
+
23
+ <xsl:template match="para">
24
+ <xsl:element name="p">
25
+ <xsl:apply-templates />
26
+ </xsl:element>
27
+ </xsl:template>
28
+
29
+ <xsl:template match="ol">
30
+ <xsl:element name="ol">
31
+ <xsl:apply-templates select="li" />
32
+ </xsl:element>
33
+ </xsl:template>
34
+
35
+ <xsl:template match="li">
36
+ <xsl:element name="li">
37
+ <xsl:value-of select="." />
38
+ </xsl:element>
39
+ </xsl:template>
40
+
41
+ <xsl:template match="thought">
42
+ <xsl:element name="i">
43
+ <xsl:value-of select="." />
44
+ </xsl:element>
45
+ </xsl:template>
46
+ </xsl:stylesheet>
@@ -0,0 +1,97 @@
1
+ require 'xslt'
2
+ require 'test/unit'
3
+
4
+ class TestDeprecated < Test::Unit::TestCase
5
+ def setup()
6
+ xsl_file = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
7
+ xml_file = File.join(File.dirname(__FILE__), 'files/fuzface.xml')
8
+
9
+ @xslt = XML::XSLT.file(xsl_file)
10
+ @xslt.doc = XML::Document.file(xml_file)
11
+ @stylesheet = @xslt.parse
12
+ end
13
+
14
+ def tear_down()
15
+ @xslt = nil
16
+ @stylesheet = nil
17
+ end
18
+
19
+ def test_constants
20
+ assert_instance_of(Fixnum, XML::XSLT::MAX_DEPTH)
21
+ assert_instance_of(Fixnum, XML::XSLT::MAX_SORT)
22
+ assert_instance_of(String, XML::XSLT::ENGINE_VERSION)
23
+ assert_instance_of(Fixnum, XML::XSLT::LIBXSLT_VERSION)
24
+ assert_instance_of(Fixnum, XML::XSLT::LIBXML_VERSION)
25
+ assert_instance_of(String, XML::XSLT::XSLT_NAMESPACE)
26
+ assert_instance_of(String, XML::XSLT::DEFAULT_URL)
27
+ assert_instance_of(String, XML::XSLT::DEFAULT_VENDOR)
28
+ assert_instance_of(String, XML::XSLT::DEFAULT_VERSION)
29
+ assert_instance_of(String, XML::XSLT::NAMESPACE_LIBXSLT)
30
+ assert_instance_of(String, XML::XSLT::NAMESPACE_SAXON)
31
+ assert_instance_of(String, XML::XSLT::NAMESPACE_XT)
32
+ assert_instance_of(String, XML::XSLT::NAMESPACE_XALAN)
33
+ assert_instance_of(String, XML::XSLT::NAMESPACE_NORM_SAXON)
34
+ end
35
+
36
+ def test_new
37
+ xslt = XML::XSLT.new
38
+ assert_instance_of(XML::XSLT::Stylesheet, xslt)
39
+
40
+ xslt.filename = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
41
+ assert_instance_of(String, xslt.filename)
42
+ end
43
+
44
+ def test_file_type
45
+ assert_instance_of(XML::XSLT::Stylesheet, @xslt)
46
+ end
47
+
48
+ def test_doc
49
+ xsl_file = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
50
+ xml_file = File.join(File.dirname(__FILE__), 'files/fuzface.xml')
51
+
52
+ xslt = XML::XSLT.file(xsl_file)
53
+ xslt.doc = XML::Document.file(xml_file)
54
+ assert_instance_of(XML::Document, xslt.doc)
55
+ end
56
+
57
+ def test_parse
58
+ xsl_file = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
59
+ xml_file = File.join(File.dirname(__FILE__), 'files/fuzface.xml')
60
+
61
+ xslt = XML::XSLT.file(xsl_file)
62
+ stylesheet = xslt.parse
63
+ assert_instance_of(XML::XSLT::Stylesheet, stylesheet)
64
+ end
65
+
66
+ def test_parse
67
+ assert_instance_of(XML::XSLT::Stylesheet, @stylesheet)
68
+ end
69
+
70
+ def test_to_s
71
+ @stylesheet.apply
72
+ str = @stylesheet.to_s
73
+ assert_instance_of(String, str)
74
+ end
75
+
76
+ def test_save
77
+ @stylesheet.apply
78
+ @stylesheet.save("text.xml")
79
+ end
80
+
81
+ def test_print_invalid
82
+ @stylesheet.apply
83
+ @stylesheet.print
84
+ end
85
+
86
+ def test_save_invalid
87
+ assert_raises(ArgumentError) do
88
+ @stylesheet.save("str")
89
+ end
90
+ end
91
+
92
+ def test_print_invalid
93
+ assert_raises(ArgumentError) do
94
+ @stylesheet.print
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,21 @@
1
+ require 'xslt'
2
+ require 'test/unit'
3
+
4
+ class TextLibXslt < Test::Unit::TestCase
5
+ def test_constants
6
+ assert_instance_of(Fixnum, XSLT::MAX_DEPTH)
7
+ assert_instance_of(Fixnum, XSLT::MAX_SORT)
8
+ assert_instance_of(String, XSLT::ENGINE_VERSION)
9
+ assert_instance_of(Fixnum, XSLT::LIBXSLT_VERSION)
10
+ assert_instance_of(Fixnum, XSLT::LIBXML_VERSION)
11
+ assert_instance_of(String, XSLT::XSLT_NAMESPACE)
12
+ assert_instance_of(String, XSLT::DEFAULT_URL)
13
+ assert_instance_of(String, XSLT::DEFAULT_VENDOR)
14
+ assert_instance_of(String, XSLT::DEFAULT_VERSION)
15
+ assert_instance_of(String, XSLT::NAMESPACE_LIBXSLT)
16
+ assert_instance_of(String, XSLT::NAMESPACE_SAXON)
17
+ assert_instance_of(String, XSLT::NAMESPACE_XT)
18
+ assert_instance_of(String, XSLT::NAMESPACE_XALAN)
19
+ assert_instance_of(String, XSLT::NAMESPACE_NORM_SAXON)
20
+ end
21
+ end
@@ -0,0 +1,108 @@
1
+ require 'xslt'
2
+ require 'test/unit'
3
+
4
+ class TestStylesheet < Test::Unit::TestCase
5
+ def setup
6
+ filename = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
7
+ doc = XML::Document.file(filename)
8
+ @stylesheet = XSLT::Stylesheet.new(doc)
9
+ end
10
+
11
+ def tear_down
12
+ @stylesheet = nil
13
+ end
14
+
15
+ def doc
16
+ filename = File.join(File.dirname(__FILE__), 'files/fuzface.xml')
17
+ XML::Document.file(filename)
18
+ end
19
+
20
+ def test_class
21
+ assert_instance_of(XSLT::Stylesheet, @stylesheet)
22
+ end
23
+
24
+ def test_apply
25
+ result = @stylesheet.apply(doc)
26
+ assert_instance_of(XML::Document, result)
27
+
28
+ paragraphs = result.find('//p')
29
+ assert_equal(11, paragraphs.length)
30
+ end
31
+
32
+ def test_apply_multiple
33
+ 10.times do
34
+ test_apply
35
+ end
36
+ end
37
+
38
+ def test_params
39
+ filename = File.join(File.dirname(__FILE__), 'files/params.xsl')
40
+ sdoc = XML::Document.file(filename)
41
+
42
+ filename = File.join(File.dirname(__FILE__), 'files/params.xml')
43
+ stylesheet = XSLT::Stylesheet.new(sdoc)
44
+ doc = XML::Document.file(filename)
45
+
46
+ # Start with no params
47
+ result = stylesheet.apply(doc)
48
+ assert_equal('<article>failure</article>', result.root.to_s)
49
+
50
+ # Now try with params as hash. /doc is evaluated
51
+ # as an xpath expression
52
+ result = stylesheet.apply(doc, 'bar' => "/doc")
53
+ assert_equal('<article>abc</article>', result.root.to_s)
54
+
55
+ # Now try with params as hash. Note the double quote
56
+ # on success - we want to pass a literal string and
57
+ # not an xpath expression.
58
+ result = stylesheet.apply(doc, 'bar' => "'success'")
59
+ assert_equal('<article>success</article>', result.root.to_s)
60
+
61
+ # Now try with params as an array.
62
+ result = stylesheet.apply(doc, ['bar', "'success'"])
63
+ assert_equal('<article>success</article>', result.root.to_s)
64
+
65
+ # Now try with invalid array.
66
+ result = stylesheet.apply(doc, ['bar'])
67
+ assert_equal('<article>failure</article>', result.root.to_s)
68
+ end
69
+
70
+ # -- Memory Tests ----
71
+ def test_doc_ownership
72
+ 10.times do
73
+ filename = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
74
+ sdoc = XML::Document.file(filename)
75
+ stylesheet = XSLT::Stylesheet.new(sdoc)
76
+
77
+ stylesheet = nil
78
+ GC.start
79
+ assert_equal(156, sdoc.to_s.length)
80
+ end
81
+ end
82
+
83
+ def test_stylesheet_ownership
84
+ 10.times do
85
+ filename = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
86
+ sdoc = XML::Document.file(filename)
87
+ stylesheet = XSLT::Stylesheet.new(sdoc)
88
+
89
+ sdoc = nil
90
+ GC.start
91
+
92
+ rdoc = stylesheet.apply(doc)
93
+ assert_equal(5993, rdoc.to_s.length)
94
+ end
95
+ end
96
+
97
+ def test_result_ownership
98
+ 10.times do
99
+ filename = File.join(File.dirname(__FILE__), 'files/fuzface.xsl')
100
+ sdoc = XML::Document.file(filename)
101
+ stylesheet = XSLT::Stylesheet.new(sdoc)
102
+
103
+ rdoc = stylesheet.apply(doc)
104
+ rdoc = nil
105
+ GC.start
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,3 @@
1
+ require 'test_libxslt'
2
+ require 'test_stylesheet'
3
+ require 'test_deprecated'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libxslt-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Charlie Savage
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-21 00:00:00 -06:00
12
+ date: 2008-11-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,14 +20,14 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.8.2
23
+ version: 0.9.0
24
24
  version:
25
25
  description: The Libxslt-Ruby project provides Ruby language bindings for the GNOME XSLT C library. It is free software, released under the MIT License.
26
26
  email: libxml-devel@rubyforge.org
27
27
  executables: []
28
28
 
29
- extensions: []
30
-
29
+ extensions:
30
+ - ext/mingw/Rakefile
31
31
  extra_rdoc_files: []
32
32
 
33
33
  files:
@@ -35,39 +35,9 @@ files:
35
35
  - README
36
36
  - LICENSE
37
37
  - setup.rb
38
- - doc/classes
39
- - doc/classes/LibXSLT
40
- - doc/classes/LibXSLT/XSLT
41
- - doc/classes/LibXSLT/XSLT/Stylesheet.html
42
- - doc/classes/LibXSLT/XSLT/TransformContext.html
43
- - doc/classes/LibXSLT/XSLT.html
44
- - doc/classes/LibXSLT/XSLTError.html
45
- - doc/classes/LibXSLT.html
46
- - doc/classes/XSLT.html
47
- - doc/created.rid
48
- - doc/files
49
- - doc/files/CHANGES.html
50
- - doc/files/ext
51
- - doc/files/ext/libxslt
52
- - doc/files/ext/libxslt/libxslt_c.html
53
- - doc/files/ext/libxslt/ruby_xslt_stylesheet_c.html
54
- - doc/files/ext/libxslt/ruby_xslt_transform_context_c.html
55
- - doc/files/lib
56
- - doc/files/lib/libxslt
57
- - doc/files/lib/libxslt/deprecated_rb.html
58
- - doc/files/lib/libxslt_rb.html
59
- - doc/files/lib/xslt_rb.html
60
- - doc/files/LICENSE.html
61
- - doc/files/README.html
62
- - doc/fr_class_index.html
63
- - doc/fr_file_index.html
64
- - doc/fr_method_index.html
65
- - doc/index.html
66
- - doc/rdoc-style.css
67
38
  - lib/libxslt
68
39
  - lib/libxslt/deprecated.rb
69
40
  - lib/libxslt.rb
70
- - lib/text.xml
71
41
  - lib/xslt.rb
72
42
  - ext/libxslt/libxslt.h
73
43
  - ext/libxslt/ruby_xslt_stylesheet.h
@@ -79,8 +49,20 @@ files:
79
49
  - ext/mingw/Rakefile
80
50
  - ext/vc/libxslt_ruby.sln
81
51
  - ext/vc/libxslt_ruby.vcproj
82
- - lib/libxslt_ruby.so
83
- - lib/libxslt-1.dll
52
+ - test/files
53
+ - test/files/commentary.dtd
54
+ - test/files/fuzface.xml
55
+ - test/files/fuzface.xsl
56
+ - test/files/params.xml
57
+ - test/files/params.xsl
58
+ - test/files/ramblings.xsl
59
+ - test/test_deprecated.rb
60
+ - test/test_libxslt.rb
61
+ - test/test_stylesheet.rb
62
+ - test/test_suite.rb
63
+ - ext/mingw/libxslt_ruby.so
64
+ - ext/mingw/libexslt-0.dll
65
+ - ext/mingw/libxslt-1.dll
84
66
  has_rdoc: true
85
67
  homepage: http://libxslt.rubyforge.org/
86
68
  post_install_message:
@@ -1,126 +0,0 @@
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: LibXSLT</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">LibXSLT</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
- :nodoc:
86
- </p>
87
-
88
- </div>
89
-
90
-
91
- </div>
92
-
93
-
94
- </div>
95
-
96
-
97
- <!-- if includes -->
98
-
99
- <div id="section">
100
-
101
- <div id="class-list">
102
- <h3 class="section-bar">Classes and Modules</h3>
103
-
104
- Module <a href="LibXSLT/XSLT.html" class="link">LibXSLT::XSLT</a><br />
105
- Class <a href="LibXSLT/XSLTError.html" class="link">LibXSLT::XSLTError</a><br />
106
-
107
- </div>
108
-
109
-
110
-
111
-
112
-
113
-
114
-
115
- <!-- if method_list -->
116
-
117
-
118
- </div>
119
-
120
-
121
- <div id="validator-badges">
122
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
123
- </div>
124
-
125
- </body>
126
- </html>