| |
---|
| | |
---|
| | # Here's the raw data. |
---|
| | # Each entry has a name (marked up as XML), a unique, short, space-less code name for it, and the actual URL. |
---|
| | # It's probably sensible to have the full URL here, rather than prefixing the Oracle document root, because it's easier to copy the entire URL from the Web browser when updating. |
---|
| | @references = |
---|
| | %references = |
---|
| | ( |
---|
| | # Name(0) Code(1) URL(2) |
---|
| | "Database Documentation Library Docs ${oracle_documentation_root}", |
---|
| | "Database Administrator<apostrophe />s Guide Admin ${oracle_documentation_root}server.111/b28310/toc.htm", |
---|
| | "Database 2 Day Developer<apostrophe />s Guide AppDev2Day ${oracle_documentation_root}appdev.111/b28843/toc.htm", |
---|
| | "Database Advanced Application Developer<apostrophe />s Guide AppDevAdv ${oracle_documentation_root}appdev.111/b28424/toc.htm", |
---|
| | "Object-Relational Developer<apostrophe />s Guide AppDevOR ${oracle_documentation_root}appdev.111/b28371/toc.htm", |
---|
| | "Database Concepts Concepts ${oracle_documentation_root}server.111/b28318/toc.htm", |
---|
| | "Database Data Warehousing Guide DataWarehousing ${oracle_documentation_root}server.111/b28313/toc.htm", |
---|
| | "Database Error Messages Errors ${oracle_documentation_root}server.111/b28278/toc.htm", |
---|
| | "Database SQL Language Reference SQL ${oracle_documentation_root}server.111/b28286/toc.htm", |
---|
| | "Database Java Developer<apostrophe />s Guide Java ${oracle_documentation_root}java.111/b31225/toc.htm", |
---|
| | "Database JDBC Developer<apostrophe />s Guide and Reference JDBC ${oracle_documentation_root}java.111/b31224/toc.htm", |
---|
| | "Database Master Glossary Glossary ${oracle_documentation_root}mix.111/b14388/toc.htm", |
---|
| | "Database Performance Tuning Guide Tuning ${oracle_documentation_root}server.111/b28274/toc.htm", |
---|
| | "Database PL/SQL Language Reference PLSQL ${oracle_documentation_root}appdev.111/b28370/toc.htm", |
---|
| | "Database PL/SQL Packages and Types Reference PLSQLPkgTyp ${oracle_documentation_root}appdev.111/b28419/toc.htm", |
---|
| | "Database Master Index Index ${oracle_documentation_root}mix.111/b14387/toc.htm", |
---|
| | "Database Reference Reference ${oracle_documentation_root}server.111/b28320/toc.htm" |
---|
| | Docs => { name => 'Database Documentation Library', |
---|
| | url => $oracle_documentation_root }, |
---|
| | Admin => { name => 'Database Administrator<apostrophe />s Guide', |
---|
| | url => $oracle_documentation_root . 'server.111/b28310/toc.htm' }, |
---|
| | AppDev2Day => { name => 'Database 2 Day Developer<apostrophe />s Guide', |
---|
| | url => $oracle_documentation_root . 'appdev.111/b28843/toc.htm' }, |
---|
| | AppDevAdv => { name => 'Database Advanced Application Developer<apostrophe />s Guide', |
---|
| | url => $oracle_documentation_root . 'appdev.111/b28424/toc.htm' }, |
---|
| | AppDevOR => { name => 'Object-Relational Developer<apostrophe />s Guide', |
---|
| | url => $oracle_documentation_root . 'appdev.111/b28371/toc.htm' }, |
---|
| | Concepts => { name => 'Database Concepts', |
---|
| | url => $oracle_documentation_root . 'server.111/b28318/toc.htm' }, |
---|
| | DataWarehousing => { name => 'Database Data Warehousing Guide', |
---|
| | url => $oracle_documentation_root . 'server.111/b28313/toc.htm' }, |
---|
| | Errors => { name => 'Database Error Messages', |
---|
| | url => $oracle_documentation_root . 'server.111/b28278/toc.htm' }, |
---|
| | SQL => { name => 'Database SQL Language Reference', |
---|
| | url => $oracle_documentation_root . 'server.111/b28286/toc.htm' }, |
---|
| | Java => { name => 'Database Java Developer<apostrophe />s Guide', |
---|
| | url => $oracle_documentation_root . 'java.111/b31225/toc.htm' }, |
---|
| | JDBC => { name => 'Database JDBC Developer<apostrophe />s Guide and Reference', |
---|
| | url => $oracle_documentation_root . 'java.111/b31224/toc.htm' }, |
---|
| | Glossary => { name => 'Database Master Glossary', |
---|
| | url => $oracle_documentation_root . 'mix.111/b14388/toc.htm' }, |
---|
| | Tuning => { name => 'Database Performance Tuning Guide', |
---|
| | url => $oracle_documentation_root . 'server.111/b28274/toc.htm' }, |
---|
| | PLSQL => { name => 'Database PL/SQL Language Reference', |
---|
| | url => $oracle_documentation_root . 'appdev.111/b28370/toc.htm' }, |
---|
| | PLSQLPkgTyp => { name => 'Database PL/SQL Packages and Types Reference', |
---|
| | url => $oracle_documentation_root . 'appdev.111/b28419/toc.htm' }, |
---|
| | Index => { name => 'Database Master Index', |
---|
| | url => $oracle_documentation_root . 'mix.111/b14387/toc.htm' }, |
---|
| | Reference => { name => 'Database Reference', |
---|
| | url => $oracle_documentation_root . 'server.111/b28320/toc.htm' }, |
---|
| | ); |
---|
| | |
---|
| | # Prefix to use in the generated template names: |
---|
| | $oracle_prefix = "Ora"; |
---|
| | |
---|
| | if ($#ARGV != 1) |
---|
| | { |
---|
| | warn "usage: oracle-docs <section-code-regexp> (xml | xslt | xslt_html | xslt_latex | link | all)\n"; |
---|
| | exit; |
---|
| | warn "usage: oracle-docs <section-code-regexp> (xml | xslt | xslt_html | xslt_latex | link | all)\n"; |
---|
| | exit; |
---|
| | } |
---|
| | |
---|
| | $section_code = $ARGV[0]; |
---|
| | $output_type = $ARGV[1]; |
---|
| | |
---|
| | if ($output_type eq "xslt") { |
---|
| | print <<END_OF_HEADER |
---|
| | print <<END_OF_HEADER |
---|
| | <?xml version="1.0"?> |
---|
| | <!-- Do not edit! Automatically generated by oracle-docs.perl! --> |
---|
| | <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
---|
| | |
---|
| |
---|
| | ; |
---|
| | } |
---|
| | |
---|
| | # One-off hard-coded template for a link to the root of the documentation set, using the URL as the anchor text. |
---|
| | # This is used in several places in the INFO 212 course book and updating them is more of a pain than implementing this! |
---|
| | # This is used in several places in the course book and updating them is more of a pain than implementing this! |
---|
| | if ($output_type eq "xslt") { |
---|
| | print <<END_OF_TEMPLATE |
---|
| | <xsl:template name="OraDocsURL" match="OraDocsURL"> |
---|
| | <xsl:call-template name="empty-hyperlink-url-internal"> |
---|
| | <xsl:with-param name="url">${oracle_documentation_root}</xsl:with-param> |
---|
| | </xsl:call-template> |
---|
| | </xsl:template> |
---|
| | print <<END_OF_TEMPLATE |
---|
| | <xsl:template name="OraDocsURL" match="OraDocsURL"> |
---|
| | <xsl:variable name="OracleURL"> |
---|
| | <xsl:element name="hyperlink"> |
---|
| | <xsl:attribute name="url"> |
---|
| | <xsl:text>${oracle_documentation_root}</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | </xsl:element> |
---|
| | </xsl:variable> |
---|
| | <xsl:apply-templates select="\$OracleURL" /> |
---|
| | </xsl:template> |
---|
| | |
---|
| | END_OF_TEMPLATE |
---|
| | ; |
---|
| | # print "<xsl:template name=\"OraDocsURL\" match=\"OraDocsURL\"><xsl:apply-templates><xsl:element name=\"hyperlink\"><xsl:attribute name=\"url\">" . $oracle_documentation_root . "</xsl:attribute></xsl:element></xsl:apply-templates></xsl:template>\n"; |
---|
| | } |
---|
| | |
---|
| | 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 "xml") { |
---|
| | print generate_xml(@fields[1]) . "\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; |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | foreach $doccode (keys %references) { |
---|
| | $docname = $references{$doccode}{'name'}; |
---|
| | $docurl = $references{$doccode}{'url'}; |
---|
| | if ($doccode =~ /$section_code/) { |
---|
| | # Print the requested stuff: |
---|
| | if ($output_type eq "xml") { |
---|
| | print generate_xml($doccode) . "\n"; |
---|
| | } elsif ($output_type eq "xslt") { |
---|
| | print generate_xsl_template($docname, $doccode, $docurl) . "\n"; |
---|
| | } elsif ($output_type eq "all") { |
---|
| | print generate_xsl_template($docname, $doccode, $docurl) . "\n"; |
---|
| | } else { |
---|
| | warn "Sorry - I don't know anything about a \"$output_type\" format.\n"; |
---|
| | exit; |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| | |
---|
| | if ($output_type eq "xslt") { |
---|
| | print "</xsl:stylesheet>\n"; |
---|
| | print "</xsl:stylesheet>\n"; |
---|
| | } |
---|
| | |
---|
| | |
---|
| | |
---|
| | # what we really need to produce is a template that calls the hyperlink template when matched. I think. |
---|
| | # Markup for a hyperlink (as defined in format-master.xml) looks like this: |
---|
| | # |
---|
| | # <hyperlink url="http://wherever/">Some Web Site</hyperlink> |
---|
| | # |
---|
| | # However, this will only match elements with a url attribute; we therefore need a new internal hyperlink that's parameterised. Should be modal (but "call-templates" doesn't seem to like it when you give it a "mode" attribute). |
---|
| | # The derived xml2html.xsl and xml2latex.xsl files will need to call this hyperlink-internal template directly: |
---|
| | # |
---|
| | # <xsl:call-template name="hyperlink-internal" mode="hyperlink-internal"> |
---|
| | # <xsl:with-param name="url">http://wherever/</xsl:with-param> |
---|
| | # <xsl:with-param name="label">Some Web Site</xsl:with-param> |
---|
| | # </xsl:call-template> |
---|
| | |
---|
| | # Generate an XSLT meta-template for generating either an HTML or a LaTeX producing template. |
---|
| | # Generate an XSLT template for generating a hyperlink to the specified Oracle document. |
---|
| | # Arguments: (<descriptive-label>, <entry-code>, <url>) |
---|
| | sub generate_xsl_metatemplate { |
---|
| | return <<END_OF_TEMPLATE |
---|
| | <xsl:template name="${oracle_prefix}${_[1]}" match="${oracle_prefix}${_[1]}"> |
---|
| | <xsl:call-template name="hyperlink-internal"> |
---|
| | <xsl:with-param name="url">${_[2]}</xsl:with-param> |
---|
| | <xsl:with-param name="label"> |
---|
| | <xsl:call-template name="OracleServer" /> ${_[0]} |
---|
| | </xsl:with-param> |
---|
| | </xsl:call-template> |
---|
| | </xsl:template> |
---|
| | sub generate_xsl_template { |
---|
| | return <<END_OF_TEMPLATE |
---|
| | <xsl:template name="${oracle_prefix}${_[1]}" match="${oracle_prefix}${_[1]}"> |
---|
| | <xsl:variable name="OracleURL"> |
---|
| | <xsl:element name="hyperlink"> |
---|
| | <xsl:attribute name="url"> |
---|
| | <xsl:text>${_[2]}</xsl:text> |
---|
| | </xsl:attribute> |
---|
| | <xsl:call-template name="OracleServer" /> |
---|
| | <xsl:text> </xsl:text> |
---|
| | ${_[0]} |
---|
| | </xsl:element> |
---|
| | </xsl:variable> |
---|
| | <xsl:apply-templates select="\$OracleURL" /> |
---|
| | </xsl:template> |
---|
| | END_OF_TEMPLATE |
---|
| | ; |
---|
| | # Nope, wrong tree here: |
---|
| | 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>"; |
---|
| | } |
---|
| | |
---|
| | |
---|
| | # Produce the actual XML markup to be used in authoring (just to provide a handy list of them all): |
---|
| | # Arguments: (<entry-code>) |
---|
| | sub generate_xml { |
---|
| | return "<" . $oracle_prefix . $_[0]. " />"; |
---|
| | return "<" . $oracle_prefix . $_[0]. " />"; |
---|
| | } |
---|
| | |
---|
| | # Produce XML markup for a link to a section of the documentation (deprecated): |
---|
| | sub generate_doc_netlink { |
---|
| | return "<netlink><label>" . $_[0] . "</label><target>" . $_[1] . "</target></netlink>"; |
---|
| | } |
---|
| | |
---|
| | # 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>"; |
---|
| | } |
---|
| | |
---|
| | |
---|