Annotation of modules/damieng/schema_documentation/update_documentation.pl, revision 1.2

1.1       damieng     1: #!/usr/bin/perl
                      2: 
                      3: # This script creates an HTML documentation for loncapa.xsd
                      4: 
                      5: use XML::LibXSLT;
                      6: use XML::LibXML;
                      7: use Cwd 'abs_path';
                      8: 
                      9: my $script_dir = abs_path($0);
                     10: my ($current_dir) = $script_dir =~ /^(.*\/).*$/;
                     11: my $xsl_path = $current_dir . 'XMLSchema.xsl';
                     12: my $schema_path = $current_dir.'../graphical_editor/loncapa_daxe/web/config/loncapa.xsd';
                     13: my $html_path = $current_dir.'loncapa.html';
                     14: 
                     15: my $parser = XML::LibXML->new();
                     16: my $xslt = XML::LibXSLT->new();
                     17: 
                     18: my $source = $parser->parse_file($schema_path);
                     19: my $style_doc = $parser->parse_file('XMLSchema.xsl');
                     20: 
                     21: my $stylesheet = $xslt->parse_stylesheet($style_doc);
                     22: 
1.2     ! damieng    23: my %parameters = (
        !            24:   'jaxe-uri-xsl' => "'".$xsl_path."'",
        !            25:   'titre' => "'LON-CAPA language reference'",
        !            26:   'langue' => "'en'",
        !            27: );
        !            28: my $result = $stylesheet->transform($source, %parameters);
1.1       damieng    29: 
                     30: print $stylesheet->output_file($result, $html_path);
                     31: 
                     32: print "loncapa.html has been updated.\n";
                     33: 

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