Skip to content

Commit

Permalink
Corregeix els includes que schematron-wrapper no tracta bé
Browse files Browse the repository at this point in the history
Els hi he obert issue Agilefreaks/schematron-wrapper#9
  • Loading branch information
descala committed Nov 22, 2019
1 parent 0fb1995 commit 3b387ad
Show file tree
Hide file tree
Showing 10 changed files with 2,120 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bin/create_xmlns_symlinks
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

require "bundler/setup"
require "xsd/validator"
require "sch/validator"

Xsd::Validator.symlink
Sch::Validator.compile
1,085 changes: 1,085 additions & 0 deletions lib/sch/compiled/BIIRULES-UBL-T10.sch.xslt

Large diffs are not rendered by default.

1,024 changes: 1,024 additions & 0 deletions lib/sch/compiled/OPENPEPPOL-UBL-T10.sch.xslt

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion lib/sch/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,20 @@ def self.compile
Dir.chdir('lib/sch/schemas/') do
Dir["*.sch","*/*.sch"].each do |schematron_file|
cache_xslt = "../compiled/#{File.basename(schematron_file)}.xslt"
compiled_schematron = Schematron::XSLT2.compile(File.read(schematron_file))
compiled_schematron = schematron_compile(schematron_file)
File.write(cache_xslt, compiled_schematron)
end
end
end

# schematron-wrapper patch ################
def self.schematron_compile(file_path)
# process_includes does not work in /tmp. it needs access to included files
temp_schematron = Schematron::XSLT2.execute_transform(Schematron::XSLT2::DSDL_INCLUDES_PATH, file_path)
temp_schematron = Schematron::XSLT2.expand_abstract_patterns(temp_schematron)
Schematron::XSLT2.create_stylesheet(temp_schematron)
end

private

def xslt_path(name)
Expand Down

0 comments on commit 3b387ad

Please sign in to comment.