Incorporated derived Oracle documentation links into XML/XSLT authoring framework.
Course content can now use markup such as <OraSQL/> and the appropriate hyperlink will be generated (as long as the data in the oracle-docs.perl script are up-to-date).
1 parent 0fa0dd1 commit e9d140a1322d44241008282ef6f5ffb008e315a6
cedwards authored on 20 Feb 2004
Showing 4 changed files
View
12
Makefile
# $Id$
 
 
.PHONY: clean
all: xml2html.xsl xml2latex.xsl
 
all: xml2html.xsl xml2latex.xsl oracle-docs.xsl
 
clean:
rm -f xml2html.xsl xml2latex.xsl
rm -f xml2html.xsl xml2latex.xsl oracle-docs.xsl
 
xml2html.xsl: format-master.xml xml2xslt.xsl Makefile
xml2html.xsl: format-master.xml xml2xslt.xsl oracle-docs.xsl Makefile
ifeq ($(XSLT),xalan-c)
Xalan -p format "'html'" $< xml2xslt.xsl > $@
else
ifeq ($(XSLT),xalan-j)
saxon $< xml2xslt.xsl format=html > $@
endif
endif
 
xml2latex.xsl: format-master.xml xml2xslt.xsl Makefile
xml2latex.xsl: format-master.xml xml2xslt.xsl oracle-docs.xsl Makefile
ifeq ($(XSLT),xalan-c)
Xalan -p format "'latex'" $< xml2xslt.xsl > $@
else
ifeq ($(XSLT),xalan-j)
saxon $< xml2xslt.xsl format=latex > $@
endif
endif
 
oracle-docs.xsl: oracle-docs.perl
perl $< '.*' xslt > $@
View
21
format-master.xml
<?xml version="1.0"?>
<!-- This will mostly be a list of element names to match, along with the corresponding HTML and LaTeX handling XSLT code. -->
<stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
 
<hyperlink>
<element>OraAdmin</element>
<url>http://info-nts-05.otago.ac.nz/docs/oracle9i/server.920/a96521/toc.htm</url>
<label>test<!--<xsl:call-template name="OracleServer"/> Database Administrator<xsl:call-template name="apostrophe"/>s Guide--></label>
</hyperlink>
 
 
<template name="PaperCode" match="PaperCode">
<latex><xsl:value-of select="$department"/>~<xsl:value-of select="$paper"/></latex>
<html>
<xsl:value-of select="$department"/>
 
<template name="hyperlink-url" match="hyperlink[@url and node()]">
<latex>\href{<xsl:value-of select="@url"/>}{<xsl:apply-templates/>}</latex>
<html><A HREF="{@url}"><xsl:apply-templates/></A></html>
</template>
 
<!-- Internal parameterised hyperlink template to be called by the likes of the empty Oracle documentation elements. -->
<template name="hyperlink-internal" match="hyperlink" mode="hyperlink-internal">
<common>
<xsl:param xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" name="url"/>
<xsl:param xmlns:xsl-out="http://www.w3.org/1999/XSL/Transform" name="label"/>
</common>
<latex>\href{<xsl:value-of select="$url"/>}{<xsl:apply-templates select="exsl:node-set($label)"/>}</latex>
<html><A HREF="{$url}"><xsl:apply-templates select="exsl:node-set($label)"/></A></html>
</template>
 
<template name="empty-hyperlink-url" match="hyperlink[@url and not(node())]">
<!-- Maybe we should be using the url package and \url{...}? -->
View
32
oracle-docs.perl
 
$section_code = $ARGV[0];
$output_type = $ARGV[1];
 
if ($output_type eq "xslt") {
print "<?xml version=\"1.0\"?>\n" .
"<!-- Do not edit! Automatically generated by oracle-docs.perl! -->\n" .
"<stylesheet version=\"1.0\" xmlns:xsl-out=\"http://www.w3.org/1999/XSL/Transform\">\n";
}
foreach $current_record (@references) {
@fields = split(/[ ]+/, $current_record);
# Only print the entries for the matching section:
if (@fields[1] =~ /$section_code/) {
}
}
}
 
if ($output_type eq "xslt") {
print "</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.
# 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>
 
 
# Produce XML markup for a link to a section of the documentation.
sub generate_doc_netlink {
 
 
# Generate an XSLT meta-template for generating either an HTML or a LaTeX producing template.
sub generate_xsl_metatemplate {
return "<xsl-out:template name=\"" . $oracle_prefix . $_[1] . "\" match=\"" . $oracle_prefix . $_[1] . "\">" .
"<xsl-out:call-template name=\"hyperlink-internal\">" . # mode=\"hyperlink-internal\">" .
"<xsl-out:with-param name=\"url\">" . $_[2] . "</xsl-out:with-param>" .
"<xsl-out:with-param name=\"label\">" . "<xsl-out:call-template name=\"OracleServer\"/>" . " " . $_[0] . "</xsl-out:with-param>" .
"</xsl-out:call-template>" .
"</xsl-out:template>";
# Nope, wrong tree:
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>";
View
xml2xslt.xsl