onix 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.7.3 (19th August 2009)
2
+ - Switch from java to xsltproc to convert short tag ONIX files
3
+ to reference tags
4
+
1
5
  v0.7.2 (19th August 2009)
2
6
  - Added ONIX::Normaliser class
3
7
  - for normalising various ONIX files into a form that makes them easy
@@ -16,7 +16,7 @@ module ONIX
16
16
  module Version #:nodoc:
17
17
  Major = 0
18
18
  Minor = 7
19
- Tiny = 2
19
+ Tiny = 3
20
20
 
21
21
  String = [Major, Minor, Tiny].join('.')
22
22
  end
@@ -39,10 +39,10 @@ module ONIX
39
39
  def initialize(oldfile, newfile)
40
40
  raise ArgumentError, "#{oldfile} does not exist" unless File.file?(oldfile)
41
41
  raise ArgumentError, "#{newfile} already exists" if File.file?(newfile)
42
- raise "java app not found" unless app_available?("which")
43
- raise "isutf8 app not found" unless app_available?("isutf8")
44
- raise "iconv app not found" unless app_available?("iconv")
45
- raise "sed app not found" unless app_available?("sed")
42
+ raise "xsltproc app not found" unless app_available?("xsltproc")
43
+ raise "isutf8 app not found" unless app_available?("isutf8")
44
+ raise "iconv app not found" unless app_available?("iconv")
45
+ raise "sed app not found" unless app_available?("sed")
46
46
 
47
47
  @oldfile = oldfile
48
48
  @newfile = newfile
@@ -98,11 +98,8 @@ module ONIX
98
98
  def to_reference_tags(src, dest)
99
99
  inpath = File.expand_path(src)
100
100
  outpath = File.expand_path(dest)
101
- xsltpath = File.dirname(__FILE__) + "/../../support/switch-onix-tagnames-1.1.xsl"
102
- # xsltproc doesn't set the DTD correctly in the output. Using
103
- # saxon instead.
104
- #`xsltproc -o #{outpath} #{xsltpath} #{inpath}`
105
- `java -jar /usr/share/java/saxon.jar #{inpath} #{xsltpath} > #{outpath}`
101
+ xsltpath = File.dirname(__FILE__) + "/../../support/switch-onix-2.1-short-to-reference.xsl"
102
+ `xsltproc -o #{outpath} #{xsltpath} #{inpath}`
106
103
  end
107
104
 
108
105
  # ensure the file is valid utf8, then make sure it's declared as such
@@ -21,6 +21,7 @@ context "ONIX::Normaliser", "with a simple short tag file" do
21
21
 
22
22
  File.file?(@outfile).should be_true
23
23
  content = File.read(@outfile)
24
+ puts content
24
25
  content.include?("<m174>").should be_false
25
26
  content.include?("<FromCompany>").should be_true
26
27
  end
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
3
+ <xsl:variable name="target"><xsl:choose>
4
+ <xsl:when test="/ONIXMessage">short</xsl:when>
5
+ <xsl:otherwise>reference</xsl:otherwise>
6
+ </xsl:choose></xsl:variable>
7
+ <xsl:output method="xml" doctype-system="http://www.editeur.org/onix/2.1/reference/onix-international.dtd"/>
8
+ <xsl:template match="*">
9
+ <xsl:variable name="target-name">
10
+ <xsl:choose>
11
+ <xsl:when test="$target='short'"><xsl:value-of select="@shortname"/></xsl:when>
12
+ <xsl:otherwise><xsl:value-of select="@refname"/></xsl:otherwise>
13
+ </xsl:choose>
14
+ </xsl:variable>
15
+ <xsl:element name="{$target-name}">
16
+ <xsl:copy-of select="@*[not(name()='refname' or name()='shortname')]"/>
17
+ <xsl:apply-templates select="*|text()"/>
18
+ </xsl:element>
19
+ </xsl:template>
20
+ <xsl:template match="text()">
21
+ <xsl:copy/>
22
+ </xsl:template>
23
+ </xsl:stylesheet>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Healy
@@ -111,6 +111,7 @@ files:
111
111
  - support/switch-onix-tagnames-1.1.xsl
112
112
  - support/extract.rb
113
113
  - support/entities.txt
114
+ - support/switch-onix-2.1-short-to-reference.xsl
114
115
  - spec/header_spec.rb
115
116
  - spec/product_spec.rb
116
117
  - spec/reader_spec.rb