File:  [LON-CAPA] / modules / damieng / schema_documentation / update_documentation.pl
Revision 1.2: download - view: text, annotated - select for diffs
Wed Jan 18 18:46:10 2017 UTC (7 years, 2 months ago) by damieng
Branches: MAIN
CVS tags: HEAD
misc documentation stylesheet improvements

#!/usr/bin/perl

# This script creates an HTML documentation for loncapa.xsd

use XML::LibXSLT;
use XML::LibXML;
use Cwd 'abs_path';

my $script_dir = abs_path($0);
my ($current_dir) = $script_dir =~ /^(.*\/).*$/;
my $xsl_path = $current_dir . 'XMLSchema.xsl';
my $schema_path = $current_dir.'../graphical_editor/loncapa_daxe/web/config/loncapa.xsd';
my $html_path = $current_dir.'loncapa.html';

my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();

my $source = $parser->parse_file($schema_path);
my $style_doc = $parser->parse_file('XMLSchema.xsl');

my $stylesheet = $xslt->parse_stylesheet($style_doc);

my %parameters = (
  'jaxe-uri-xsl' => "'".$xsl_path."'",
  'titre' => "'LON-CAPA language reference'",
  'langue' => "'en'",
);
my $result = $stylesheet->transform($source, %parameters);

print $stylesheet->output_file($result, $html_path);

print "loncapa.html has been updated.\n";


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>