GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
1
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
XML
Browse code
- Created Perl script for generating markup and XSLT templates for the Oracle documentation set.
- Added 'clean' target to Makefile.
master
OLD_GRAPHICS_HANDLING
1 parent
faac871
commit
0fa0dd1819db011ebe9fd567cb0366d6ebbc6228
cedwards
authored
on 18 Feb 2004
Patch
Showing
2 changed files
Makefile
oracle-docs.perl
Ignore Space
Show notes
View
Makefile
# $Id$ .PHONY: clean all: xml2html.xsl xml2latex.xsl clean: rm -f xml2html.xsl xml2latex.xsl xml2html.xsl: format-master.xml xml2xslt.xsl Makefile ifeq ($(XSLT),xalan-c) Xalan -p format "'html'" $< xml2xslt.xsl > $@ else ifeq ($(XSLT),xalan-j) xalan -param format "'html'" $< xml2xslt.xsl > $@ else saxon $< xml2xslt.xsl format=html > $@ endif endif xml2latex.xsl: format-master.xml xml2xslt.xsl Makefile ifeq ($(XSLT),xalan-c) Xalan -p format "'latex'" $< xml2xslt.xsl > $@ else ifeq ($(XSLT),xalan-j) xalan -param format "'latex'" $< xml2xslt.xsl > $@ else saxon $< xml2xslt.xsl format=latex > $@ endif endif
# $Id$ all: xml2html.xsl xml2latex.xsl xml2html.xsl: format-master.xml xml2xslt.xsl Makefile ifeq ($(XSLT),xalan-c) Xalan -p format "'html'" $< xml2xslt.xsl > $@ else ifeq ($(XSLT),xalan-j) xalan -param format "'html'" $< xml2xslt.xsl > $@ else saxon $< xml2xslt.xsl format=html > $@ endif endif xml2latex.xsl: format-master.xml xml2xslt.xsl Makefile ifeq ($(XSLT),xalan-c) Xalan -p format "'latex'" $< xml2xslt.xsl > $@ else ifeq ($(XSLT),xalan-j) xalan -param format "'latex'" $< xml2xslt.xsl > $@ else saxon $< xml2xslt.xsl format=latex > $@ endif endif
Ignore Space
Show notes
View
oracle-docs.perl
0 → 100755
#!/usr/bin/perl # # $Id$ # # Basic script for generating XML markup for the major sections of the Oracle Documentation, and XSLT templates (and meta-templates, for both output formats) for transforming it. # # To do: # * respond to different command line parameters: produce either markup, XSLT for HTML, XSLT for LaTeX, or XSLT for both; produce only for the specified section (identified by its Code). # Here's the raw data (this used to be in an Excel spreadsheet, which now obviously shouldn't be used any more - might remove from CVS some time). # Each entry has a name (marked up as XML), a unique, short, space-less code, and the actual URL. @references = ( # Name(0) Code(1) URL(2) "Database Administrator<apostrophe/>s Guide Admin http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96521/toc.htm", "Application Developer<apostrophe/>s Guide<emdash/>Object-Relational Features AppDevOR http://info-nts-05.otago.ac.nz/docs/oracle9i/appdev.920/a96594/toc.htm", "Database Concepts Concepts http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96524/toc.htm", "Data Warehousing DataWarehousing http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96520/toc.htm", "Database Error Messages Errors http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96525/toc.htm", "SQL Reference SQL http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96540/toc.htm", "Java Developer<apostrophe/>s Guide Java http://info-nts-05.otago.ac.nz/docs/oracle9i/java.920/a96656/toc.htm", "JDBC Developer<apostrophe/>s Guide and Reference JDBC http://info-nts-05.otago.ac.nz/docs/oracle9i/java.920/a96654/toc.htm", "Database Master Glossary Glossary http://info-nts-05.otago.ac.nz/docs/oracle9i/mix.920/a97290/toc.htm", "Database Performance Tuning Guide and Reference Tuning http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96533/toc.htm", "PL/SQL User<apostrophe/>s Guide and Reference PLSQL http://info-nts-05.otago.ac.nz/docs/oracle9i/appdev.920/a96624/toc.htm", "Database Master Index Index http://info-nts-05.otago.ac.nz/docs/oracle9i/mix.920/a96625/toc.htm", "Database Reference Reference http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96536/toc.htm" ); # Prefix to use in the generated template names: $oracle_prefix = "Ora"; if ($#ARGV != 1) { warn "usage: oracle-docs <section-code-regexp> (link | xslt | xslt_html | xslt_latex | all)\n"; exit; } $section_code = $ARGV[0]; $output_type = $ARGV[1]; foreach $current_record (@references) { @fields = split(/[ ]+/, $current_record); # Only print the entries for the matching section: if (@fields[1] =~ /$section_code/) { # Print the requested stuff: if ($output_type eq "link") { print generate_doc_netlink(@fields[0], @fields[2]) . "\n"; } elsif ($output_type eq "xslt") { print generate_xsl_metatemplate(@fields[0], @fields[1], @fields[2]) . "\n"; } elsif ($output_type eq "xslt_html") { print generate_xsl_template_for_html(@fields[0], @fields[1], @fields[2]) . "\n"; } elsif ($output_type eq "xslt_latex") { print generate_xsl_template_for_latex(@fields[0], @fields[1], @fields[2]) . "\n"; } elsif ($output_type eq "all") { print generate_doc_netlink(@fields[0], @fields[2]) . "\n"; print generate_xsl_metatemplate(@fields[0], @fields[1], @fields[2]) . "\n"; print generate_xsl_template_for_html(@fields[0], @fields[1], @fields[2]) . "\n"; print generate_xsl_template_for_latex(@fields[0], @fields[1], @fields[2]) . "\n"; } else { warn "Sorry - I don't know anything about a \"$output_type\" format.\n"; exit; } } } # Produce XML markup for a link to a section of the documentation. sub generate_doc_netlink { return "<netlink><label>" . $_[0] . "</label><target>" . $_[1] . "</target></netlink>"; } # Generate an XSLT meta-template for generating either an HTML or a LaTeX producing template. sub generate_xsl_metatemplate { return "<xsl:template name=\"" . $oracle_prefix . $_[1] . "\" match=\"" . $oracle_prefix . $_[1] . "\">" . "<latex>" . "\\href{" . $_[2] . "}" . "{" . "<xsl:call-template name=\"OracleServer\"/>" . " " . $_[0] . "}" . "</latex>" . "<html>" . "<a href=\"" . $_[2]. "\">" . "<xsl:call-template name=\"OracleServer\"/>" . " " . $_[0] . "</a>" . "</html>" . "</xsl:template>"; } # Generate an XSLT template for HTML output (deprecated): sub generate_xsl_template_for_html { return "<xsl:template match=\"" . $_[0] . "\"><A><xsl:attribute name=\"HREF\">" . $_[1] . "</xsl:attribute>" . "<xsl:call-template name=\"OracleServer\"/> " . $_[2] . "</A></xsl:template>"; } # Generate an XSLT template for LaTeX output (deprecated): sub generate_xsl_template_for_latex { return "<xsl:template match=\"" . $_[0] . "\">\\href{" . $_[1] . "}{<xsl:call-template name=\"OracleServer\"/> " . $_[2] . "}</xsl:template>"; }
Show line notes below