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
Removed now obsolete CVS substitutions.
master
1 parent
9070903
commit
4cbbe3ccf11d475152fa825816eb1b44b13f8a2a
Nigel Stanger
authored
on 13 Jun 2013
Patch
Showing
3 changed files
Makefile
generate_calendar_dates.php
oracle-docs.perl
Ignore Space
Show notes
View
Makefile
################################################################################ # # Makefile for building the INFO database courses XML formatting stylesheets. # (We really need a better name :) # ################################################################################ SHELL=/bin/sh ################################################################################ # # Required Environment Variables # # TEACHING_SHARED # This variable specifies the path to the top level of the teaching # shared directory hierarchy (e.g., /path/to/Teaching/Shared). # TEACHING_SHARED?=$(error The required environment variable TEACHING_SHARED has not been defined. It should point to the root level of the shared teaching directory (e.g., /path/to/Teaching/Shared)) ################################################################################ # # Set up paths to makefile include directories. # # GLOBAL_HANDBOOK_INCLUDE is the global include directory in the "Shared" # hierarchy, and is defined relative to the root of that hierarchy. # GLOBAL_HANDBOOK_INCLUDE?=$(TEACHING_SHARED)/Authoring/Handbook/make-includes ################################################################################ # # Include local system-specific configuration. # include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make ################################################################################ # # Include the XSLT processing functions. Note that we are assuming a fixed # path relative to the current directory! # include $(GLOBAL_HANDBOOK_INCLUDE)/xslt_functions.make .PHONY: all clean MODULES:=$(shell $(FIND) modules -type f -name "*.xml" ) all: xml2html.xsl xml2xhtml.xsl xml2latex.xsl xml2xelatex.xsl oracle-docs.xsl modules/paper-calendar-dates.xml xml2html.xsl xml2latex.xsl xml2xelatex.xsl: format-master.xml $(MODULES) xml2xslt.xsl oracle-docs.xsl Makefile $(call xslt,$<,xml2xslt.xsl,$(call xslt_parameter,target-format,$(@:xml2%.xsl=%))) > $@ # Since it seems impossible in XSLT to generate an xmlns attribute for the # <html> element, we have to add the attribute after the fact :(. xml2xhtml.xsl: format-master.xml $(MODULES) xml2xslt.xsl oracle-docs.xsl modules/paper-calendar-dates.xml Makefile $(call xslt,$<,xml2xslt.xsl,$(call xslt_parameter,target-format,$(@:xml2%.xsl=%))) > $@ format-master.xml: modules/paper-calendar-dates.xml modules/paper-calendar-dates.xml: generate_calendar_dates.php php $< > $@ oracle-docs.xsl: oracle-docs.perl perl $< '.*' xslt > $@ clean: rm -f xml2html.xsl xml2xhtml.xsl xml2latex.xsl xml2xelatex.xsl oracle-docs.xsl modules/paper-calendar-dates.xml
################################################################################ # # File: $Id$ # # Makefile for building the INFO database courses XML formatting stylesheets. # (We really need a better name :) # ################################################################################ SHELL=/bin/sh ################################################################################ # # Required Environment Variables # # TEACHING_SHARED # This variable specifies the path to the top level of the teaching # shared directory hierarchy (e.g., /path/to/Teaching/Shared). # TEACHING_SHARED?=$(error The required environment variable TEACHING_SHARED has not been defined. It should point to the root level of the shared teaching directory (e.g., /path/to/Teaching/Shared)) ################################################################################ # # Set up paths to makefile include directories. # # GLOBAL_HANDBOOK_INCLUDE is the global include directory in the "Shared" # hierarchy, and is defined relative to the root of that hierarchy. # GLOBAL_HANDBOOK_INCLUDE?=$(TEACHING_SHARED)/Authoring/Handbook/make-includes ################################################################################ # # Include local system-specific configuration. # include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make ################################################################################ # # Include the XSLT processing functions. Note that we are assuming a fixed # path relative to the current directory! # include $(GLOBAL_HANDBOOK_INCLUDE)/xslt_functions.make .PHONY: all clean MODULES:=$(shell $(FIND) modules -type f -name "*.xml" ) all: xml2html.xsl xml2xhtml.xsl xml2latex.xsl xml2xelatex.xsl oracle-docs.xsl modules/paper-calendar-dates.xml xml2html.xsl xml2latex.xsl xml2xelatex.xsl: format-master.xml $(MODULES) xml2xslt.xsl oracle-docs.xsl Makefile $(call xslt,$<,xml2xslt.xsl,$(call xslt_parameter,target-format,$(@:xml2%.xsl=%))) > $@ # Since it seems impossible in XSLT to generate an xmlns attribute for the # <html> element, we have to add the attribute after the fact :(. xml2xhtml.xsl: format-master.xml $(MODULES) xml2xslt.xsl oracle-docs.xsl modules/paper-calendar-dates.xml Makefile $(call xslt,$<,xml2xslt.xsl,$(call xslt_parameter,target-format,$(@:xml2%.xsl=%))) > $@ format-master.xml: modules/paper-calendar-dates.xml modules/paper-calendar-dates.xml: generate_calendar_dates.php php $< > $@ oracle-docs.xsl: oracle-docs.perl perl $< '.*' xslt > $@ clean: rm -f xml2html.xsl xml2xhtml.xsl xml2latex.xsl xml2xelatex.xsl oracle-docs.xsl modules/paper-calendar-dates.xml
Ignore Space
Show notes
View
generate_calendar_dates.php
<?php /* This script generates an XSLT include file that contains templates specifying the date ranges for every week of the three main teaching periods through the year (i.e., summer school, first semester, second semester). Simply set the configuration as outlined below and make to regenerate the templates. */ /* Date of the Monday of the first academic week of the year. Teaching weeks start on Monday, so this is a convenient base point to start from. This will need to be updated annually. */ $first_monday = new DateTime( "2012-12-31" ); /* Teaching period configuration. This will need to be updated annually. It's easily extensible to a new teaching period simply by adding a new specification for that period. The key should be mixed-case alphanumeric (i.e., no whitespace, no punctuation or other special characters). The components of each period specification are: first_week: The academic week number of the first week of the period. last_week: The academic week number of the last week of the period. break_weeks: A list of breaks that occur during the teaching period. Each is specified by the start (break_start) and end (break_end) week. If a break is only one week long, then break_start and break_end should be equal. If there are no breaks in the teaching period, include a single break specification with both break_start and break_end set to zero. The list should ideally be in ascending order, but the script doesn't assume this and sorts the list anyway. Weeks are numbered by academic week number rather than week within the teaching period. */ $periods = array( 'SS' => array( 'first_week' => 2, 'last_week' => 7, 'break_weeks' => array( array( 'break_starts' => 0, 'break_ends' => 0, ), ), ), 'S1' => array( 'first_week' => 9, 'last_week' => 22, 'break_weeks' => array( array( 'break_starts' => 15, 'break_ends' => 15, ), ), ), 'S2' => array( 'first_week' => 28, 'last_week' => 41, 'break_weeks' => array( array( 'break_starts' => 35, 'break_ends' => 35, ), ), ), 'FY' => array( 'first_week' => 9, 'last_week' => 41, 'break_weeks' => array( array( 'break_starts' => 23, 'break_ends' => 27, ), array( 'break_starts' => 15, 'break_ends' => 15, ), array( 'break_starts' => 35, 'break_ends' => 35, ), ), ), ); // We need a condition to validate the period code in the templates. $period_condition = sprintf( "( @period = '%s' )", implode( "' ) or ( @period = '", array_keys( $periods ) ) ); // We also a list of valid period code values for the error string. $period_list = sprintf( '"%s"', implode( '", "', array_keys( $periods ) ) ); // The period and week variables are defined identically in both templates, so // let's define them just once here to ensure consistency. $shared_parameters = <<<EOT <xsl:with-param name="period"> <xsl:choose> <xsl:when test="{$period_condition}"> <xsl:value-of select="@period" /> </xsl:when> <!-- This also covers the case of @period being undefined. --> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Attribute "period" must be one of the values {$period_list}.</xsl:text> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:with-param> <xsl:with-param name="week"> <xsl:value-of select="@week" /> <xsl:if test="not( @week )"> <xsl:message terminate="yes"> <xsl:text>The "week" attribute is required.</xsl:text> </xsl:message> </xsl:if> </xsl:with-param> EOT; // Generate the file header and the wrapper templates. print<<<EOT <?xml version="1.0" encoding="utf-8"?> <!-- DO NOT EDIT! Automatically generated by ../generate_calendar_dates.php! Elements and templates for generating teaching period dates. Apart from the wrapper templates, this essentially boils down to a giant parameterised lookup table, which is generated by a script. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Generate a date for a given teaching week in a teaching period, in the specified format. Return the date of the Monday of the week, plus an optional signed offset. @period: The teaching period for which to generate the date. [required] @week: The number of the week in the specified teaching period. [required] @format: How to format the date. 'day+long-name' => [FNn] [D] [MNn] (e.g., Friday 10 August) 'day+short-name' => [FNn,*-3] [D] [MNn] (e.g., Fri 10 August) 'day' => [D] [MNn] (e.g., 10 August) 'day-short' => [D] [MNn,*-3] (e.g., 10 Aug) 'ISO' => [Y0001]-[M01]-[D01] (e.g., 2012-08-10) date picture string => Any valid XSLT date picture specification (see http://www.w3.org/TR/xslt20/#date-picture-string). @offset: A signed offset specified as an XSLT duration, e.g., "P1D" for plus one day, "-P4D" for minus four days. --> <template name="TeachingPeriodDate" match="TeachingPeriodDate"> <common> <xsl:call-template name="format-teaching-date"> {$shared_parameters} <xsl:with-param name="format"> <xsl:choose> <!-- Named date formats. --> <xsl:when test="@format = 'day+long-name'"> <xsl:text>[FNn] [D] [MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'day+short-name'"> <xsl:text>[FNn,*-3] [D] [MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'day'"> <xsl:text>[D] [MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'day-short'"> <xsl:text>[D] [MNn,*-3]</xsl:text> </xsl:when> <xsl:when test="@format = 'ISO'"> <xsl:text>[Y0001]-[M01]-[D01]</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="@format" /> </xsl:otherwise> </xsl:choose> <xsl:if test="not( @format )"> <xsl:text>[Y0001]-[M01]-[D01]</xsl:text> </xsl:if> </xsl:with-param> <xsl:with-param name="offset"> <xsl:value-of select="@offset" /> <xsl:if test="not( @offset )"> <xsl:text>P0D</xsl:text> </xsl:if> </xsl:with-param> </xsl:call-template> </common> </template> <!-- Generate a date range corresponding to a given teaching week in a teaching period (i.e., Monday to Friday). @period: The teaching period for which to generate the date. [required] @week: The number of the week in the specified teaching period. [required] @format: How to format the month name in the date range. 'long' => Output the full month name (e.g., August) 'short' => Output only the first three characters of the month name (e.g., Aug) @wrap: Whether to wrap the date range across two lines (usually for insertion into a narrow cell in a calendar table). 'true' [default] 'false' --> <template name="TeachingPeriodDateRange" match="TeachingPeriodDateRange"> <common> <xsl:call-template name="format-teaching-date-range"> {$shared_parameters} <xsl:with-param name="month-format"> <xsl:choose> <xsl:when test="@format = 'long'"> <xsl:text>[MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'short'"> <xsl:text>[MNn,*-3]</xsl:text> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Attribute "format" must be either "long" or "short", not "</xsl:text> <xsl:value-of select="@format" /> <xsl:text>".</xsl:text> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:with-param> <!-- Convert @wrap into a boolean value. --> <xsl:with-param name="wrap"> <xsl:value-of select="@wrap = 'yes'" /> </xsl:with-param> </xsl:call-template> </common> </template> EOT; // Generate the XSLT templates that do all the work. These essentially end up being huge parameterised lookup tables. generate_template( $first_monday, $periods, 'format-teaching-date' ); generate_template( $first_monday, $periods, 'format-teaching-date-range' ); // Footer boilerplate. print( "</stylesheet>\n" ); exit; //////////////////////////////////////////////////////////////////////////////// function generate_template( $first_monday, $periods, $template_name ) { // A couple of handy date intervals: four days to the end of the current week, // and seven days to the start of next week. $plus_four_days = new DateInterval( 'P4D' ); $plus_seven_days = new DateInterval( 'P7D' ); // Initial boilerplate for the template. switch ( $template_name ) { case 'format-teaching-date': print<<<EOT <!-- Generate a date (default Monday) for the specified teaching period and week (or break), using the specified date format, with an optional offset from the Monday of the week. Most of the body of this template is automatically generated by the script ../generate_calendar_dates.php. See the attributes of the TeachingPeriodDate template above for descriptions of the parameters. --> <template name="format-teaching-date"> <common> <xsl:param name="period" as="xs:string" /> <xsl:param name="week" as="xs:string" /> <xsl:param name="format" as="xs:string" /> <xsl:param name="offset" as="xs:dayTimeDuration" /> <xsl:choose> EOT; break; case 'format-teaching-date-range': print<<<EOT <!-- Generate a date range for the specified teaching period and week (or break), using the specified month format, with optional wrapping. Most of the body of this template is automatically generated by the script ../generate_calendar_dates.php. See the attributes of the TeachingPeriodDateRange template above for descriptions of the parameters. \$month-format is derived from @format. --> <template name="format-teaching-date-range"> <common> <xsl:param name="period" as="xs:string" /> <xsl:param name="week" as="xs:string" /> <xsl:param name="month-format" as="xs:string" /> <xsl:param name="wrap" as="xs:boolean" /> <xsl:choose> EOT; break; default: // WTF?!? print "Unrecognised template name \"$template_name\", terminating.\n"; exit; break; } // switch template name // Generate XSLT code for each teaching period. foreach ( $periods as $period_name => $period_data ) { print<<<EOT <xsl:when test="\$period = '{$period_name}'"> <xsl:choose> EOT; $week_start = clone( $first_monday ); // Jump forward the correct number of weeks to the start of the teaching period. $week_start->add( new DateInterval( sprintf( "P%dD", ( $period_data['first_week'] - 1 ) * 7 ) ) ); $week_number = 0; $num_breaks = 0; // Grab the first break week off the front of the list. sort( $period_data['break_weeks'] ); $break_week = array_shift( $period_data['break_weeks'] ); // Generate XSLT code for each teaching week and breaks within the period. for ( $week = $period_data['first_week']; $week <= $period_data['last_week']; $week++ ) { $week_end = clone( $week_start ); $week_end->add( $plus_four_days ); // Handle breaks. if ( ( $week >= $break_week['break_starts'] ) && ( $week <= $break_week['break_ends'] ) ) { if ( $week == $break_week['break_starts'] ) { $num_breaks++; // Work out the end date of the break. $break_end = clone( $week_start ); // Note: +4 days to get to Friday. $break_end->add( new DateInterval( sprintf( "P%dD", ( ( $break_week['break_ends'] - $break_week['break_starts'] ) * 7 ) + 4 ) ) ); switch ( $template_name ) { case 'format-teaching-date': generate_date( "B{$num_breaks}", $week_start ); break; case 'format-teaching-date-range': if ( $week_start->format( 'n' ) == $break_end->format( 'n' ) ) { generate_same_month_date_range( "B{$num_breaks}", $week_start, $break_end ); } // if break start and break end are in the same month else { generate_different_month_date_range( "B{$num_breaks}", $week_start, $break_end ); } // else break start and break end are in different months break; default: // WTF?!? print "Unrecognised template name \"$template_name\", terminating.\n"; exit; break; } // switch template name } // if current week == first week of break if ( $week == $break_week['break_ends'] ) { // Grab the next break week off the front of the list. $break_week = array_shift( $period_data['break_weeks'] ); } // if current week == last week of break } // if current week is a break week else { $week_number++; switch ( $template_name ) { case 'format-teaching-date': generate_date( $week_number, $week_start ); break; case 'format-teaching-date-range': if ( $week_start->format( 'n' ) == $week_end->format( 'n' ) ) { generate_same_month_date_range( $week_number, $week_start, $week_end ); } // if break start and break end are in the same month else { generate_different_month_date_range( $week_number, $week_start, $week_end ); } // else break start and break end are in different months break; default: // WTF?!? print "Unrecognised template name \"$template_name\", terminating.\n"; exit; break; } // switch template name } // else normal teaching week $week_start->add( $plus_seven_days ); } // for each week // Terminating boilerplate for this teaching period. print<<<EOT <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Invalid {$period_name} week specification "</xsl:text> <xsl:value-of select="\$week" /> <xsl:text>".</xsl:text> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:when> EOT; } // foreach teaching period // Terminating boilerplate for the template. print<<<EOT </xsl:choose> </common> </template> EOT; } // generate_template //////////////////////////////////////////////////////////////////////////////// function generate_date( $week_spec, $date ) { print<<<EOT <xsl:when test="\$week = '{$week_spec}'"> <xsl:value-of select="format-date( xs:date( '{$date->format( 'Y-m-d' )}' ) + \$offset, \$format )" /> </xsl:when> EOT; } // generate_same_month_date_range //////////////////////////////////////////////////////////////////////////////// function generate_same_month_date_range( $week_spec, $start_date, $end_date ) { print<<<EOT <xsl:when test="\$week = '{$week_spec}'"> <xsl:value-of select="format-date( xs:date( '{$start_date->format( 'Y-m-d' )}' ), '[D]' )" /> <xsl:call-template name="endash" /> <xsl:value-of select="format-date( xs:date( '{$end_date->format( 'Y-m-d' )}' ), '[D] ' )" /> <xsl:if test="\$wrap"> <xsl:call-template name="newline" /> </xsl:if> <xsl:value-of select="format-date( xs:date( '{$end_date->format( 'Y-m-d' )}' ), \$month-format )" /> </xsl:when> EOT; } // generate_same_month_date_range function generate_different_month_date_range( $week_spec, $start_date, $end_date ) { print<<<EOT <xsl:when test="\$week = '{$week_spec}'"> <xsl:value-of select="format-date( xs:date( '{$start_date->format( 'Y-m-d' )}' ), concat( '[D] ', \$month-format ) )" /> <xsl:if test="\$wrap"> <xsl:call-template name="newline" /> </xsl:if> <xsl:call-template name="endash" /> <xsl:value-of select="format-date( xs:date( '{$end_date->format( 'Y-m-d' )}' ), concat( '[D] ', \$month-format ) )" /> </xsl:when> EOT; } // generate_different_month_date_range ?>
<?php /* File: $Id$ This script generates an XSLT include file that contains templates specifying the date ranges for every week of the three main teaching periods through the year (i.e., summer school, first semester, second semester). Simply set the configuration as outlined below and make to regenerate the templates. */ /* Date of the Monday of the first academic week of the year. Teaching weeks start on Monday, so this is a convenient base point to start from. This will need to be updated annually. */ $first_monday = new DateTime( "2012-12-31" ); /* Teaching period configuration. This will need to be updated annually. It's easily extensible to a new teaching period simply by adding a new specification for that period. The key should be mixed-case alphanumeric (i.e., no whitespace, no punctuation or other special characters). The components of each period specification are: first_week: The academic week number of the first week of the period. last_week: The academic week number of the last week of the period. break_weeks: A list of breaks that occur during the teaching period. Each is specified by the start (break_start) and end (break_end) week. If a break is only one week long, then break_start and break_end should be equal. If there are no breaks in the teaching period, include a single break specification with both break_start and break_end set to zero. The list should ideally be in ascending order, but the script doesn't assume this and sorts the list anyway. Weeks are numbered by academic week number rather than week within the teaching period. */ $periods = array( 'SS' => array( 'first_week' => 2, 'last_week' => 7, 'break_weeks' => array( array( 'break_starts' => 0, 'break_ends' => 0, ), ), ), 'S1' => array( 'first_week' => 9, 'last_week' => 22, 'break_weeks' => array( array( 'break_starts' => 15, 'break_ends' => 15, ), ), ), 'S2' => array( 'first_week' => 28, 'last_week' => 41, 'break_weeks' => array( array( 'break_starts' => 35, 'break_ends' => 35, ), ), ), 'FY' => array( 'first_week' => 9, 'last_week' => 41, 'break_weeks' => array( array( 'break_starts' => 23, 'break_ends' => 27, ), array( 'break_starts' => 15, 'break_ends' => 15, ), array( 'break_starts' => 35, 'break_ends' => 35, ), ), ), ); // We need a condition to validate the period code in the templates. $period_condition = sprintf( "( @period = '%s' )", implode( "' ) or ( @period = '", array_keys( $periods ) ) ); // We also a list of valid period code values for the error string. $period_list = sprintf( '"%s"', implode( '", "', array_keys( $periods ) ) ); // The period and week variables are defined identically in both templates, so // let's define them just once here to ensure consistency. $shared_parameters = <<<EOT <xsl:with-param name="period"> <xsl:choose> <xsl:when test="{$period_condition}"> <xsl:value-of select="@period" /> </xsl:when> <!-- This also covers the case of @period being undefined. --> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Attribute "period" must be one of the values {$period_list}.</xsl:text> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:with-param> <xsl:with-param name="week"> <xsl:value-of select="@week" /> <xsl:if test="not( @week )"> <xsl:message terminate="yes"> <xsl:text>The "week" attribute is required.</xsl:text> </xsl:message> </xsl:if> </xsl:with-param> EOT; // Generate the file header and the wrapper templates. print<<<EOT <?xml version="1.0" encoding="utf-8"?> <!-- DO NOT EDIT! Automatically generated by ../generate_calendar_dates.php! Elements and templates for generating teaching period dates. Apart from the wrapper templates, this essentially boils down to a giant parameterised lookup table, which is generated by a script. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Generate a date for a given teaching week in a teaching period, in the specified format. Return the date of the Monday of the week, plus an optional signed offset. @period: The teaching period for which to generate the date. [required] @week: The number of the week in the specified teaching period. [required] @format: How to format the date. 'day+long-name' => [FNn] [D] [MNn] (e.g., Friday 10 August) 'day+short-name' => [FNn,*-3] [D] [MNn] (e.g., Fri 10 August) 'day' => [D] [MNn] (e.g., 10 August) 'day-short' => [D] [MNn,*-3] (e.g., 10 Aug) 'ISO' => [Y0001]-[M01]-[D01] (e.g., 2012-08-10) date picture string => Any valid XSLT date picture specification (see http://www.w3.org/TR/xslt20/#date-picture-string). @offset: A signed offset specified as an XSLT duration, e.g., "P1D" for plus one day, "-P4D" for minus four days. --> <template name="TeachingPeriodDate" match="TeachingPeriodDate"> <common> <xsl:call-template name="format-teaching-date"> {$shared_parameters} <xsl:with-param name="format"> <xsl:choose> <!-- Named date formats. --> <xsl:when test="@format = 'day+long-name'"> <xsl:text>[FNn] [D] [MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'day+short-name'"> <xsl:text>[FNn,*-3] [D] [MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'day'"> <xsl:text>[D] [MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'day-short'"> <xsl:text>[D] [MNn,*-3]</xsl:text> </xsl:when> <xsl:when test="@format = 'ISO'"> <xsl:text>[Y0001]-[M01]-[D01]</xsl:text> </xsl:when> <xsl:otherwise> <xsl:value-of select="@format" /> </xsl:otherwise> </xsl:choose> <xsl:if test="not( @format )"> <xsl:text>[Y0001]-[M01]-[D01]</xsl:text> </xsl:if> </xsl:with-param> <xsl:with-param name="offset"> <xsl:value-of select="@offset" /> <xsl:if test="not( @offset )"> <xsl:text>P0D</xsl:text> </xsl:if> </xsl:with-param> </xsl:call-template> </common> </template> <!-- Generate a date range corresponding to a given teaching week in a teaching period (i.e., Monday to Friday). @period: The teaching period for which to generate the date. [required] @week: The number of the week in the specified teaching period. [required] @format: How to format the month name in the date range. 'long' => Output the full month name (e.g., August) 'short' => Output only the first three characters of the month name (e.g., Aug) @wrap: Whether to wrap the date range across two lines (usually for insertion into a narrow cell in a calendar table). 'true' [default] 'false' --> <template name="TeachingPeriodDateRange" match="TeachingPeriodDateRange"> <common> <xsl:call-template name="format-teaching-date-range"> {$shared_parameters} <xsl:with-param name="month-format"> <xsl:choose> <xsl:when test="@format = 'long'"> <xsl:text>[MNn]</xsl:text> </xsl:when> <xsl:when test="@format = 'short'"> <xsl:text>[MNn,*-3]</xsl:text> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Attribute "format" must be either "long" or "short", not "</xsl:text> <xsl:value-of select="@format" /> <xsl:text>".</xsl:text> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:with-param> <!-- Convert @wrap into a boolean value. --> <xsl:with-param name="wrap"> <xsl:value-of select="@wrap = 'yes'" /> </xsl:with-param> </xsl:call-template> </common> </template> EOT; // Generate the XSLT templates that do all the work. These essentially end up being huge parameterised lookup tables. generate_template( $first_monday, $periods, 'format-teaching-date' ); generate_template( $first_monday, $periods, 'format-teaching-date-range' ); // Footer boilerplate. print( "</stylesheet>\n" ); exit; //////////////////////////////////////////////////////////////////////////////// function generate_template( $first_monday, $periods, $template_name ) { // A couple of handy date intervals: four days to the end of the current week, // and seven days to the start of next week. $plus_four_days = new DateInterval( 'P4D' ); $plus_seven_days = new DateInterval( 'P7D' ); // Initial boilerplate for the template. switch ( $template_name ) { case 'format-teaching-date': print<<<EOT <!-- Generate a date (default Monday) for the specified teaching period and week (or break), using the specified date format, with an optional offset from the Monday of the week. Most of the body of this template is automatically generated by the script ../generate_calendar_dates.php. See the attributes of the TeachingPeriodDate template above for descriptions of the parameters. --> <template name="format-teaching-date"> <common> <xsl:param name="period" as="xs:string" /> <xsl:param name="week" as="xs:string" /> <xsl:param name="format" as="xs:string" /> <xsl:param name="offset" as="xs:dayTimeDuration" /> <xsl:choose> EOT; break; case 'format-teaching-date-range': print<<<EOT <!-- Generate a date range for the specified teaching period and week (or break), using the specified month format, with optional wrapping. Most of the body of this template is automatically generated by the script ../generate_calendar_dates.php. See the attributes of the TeachingPeriodDateRange template above for descriptions of the parameters. \$month-format is derived from @format. --> <template name="format-teaching-date-range"> <common> <xsl:param name="period" as="xs:string" /> <xsl:param name="week" as="xs:string" /> <xsl:param name="month-format" as="xs:string" /> <xsl:param name="wrap" as="xs:boolean" /> <xsl:choose> EOT; break; default: // WTF?!? print "Unrecognised template name \"$template_name\", terminating.\n"; exit; break; } // switch template name // Generate XSLT code for each teaching period. foreach ( $periods as $period_name => $period_data ) { print<<<EOT <xsl:when test="\$period = '{$period_name}'"> <xsl:choose> EOT; $week_start = clone( $first_monday ); // Jump forward the correct number of weeks to the start of the teaching period. $week_start->add( new DateInterval( sprintf( "P%dD", ( $period_data['first_week'] - 1 ) * 7 ) ) ); $week_number = 0; $num_breaks = 0; // Grab the first break week off the front of the list. sort( $period_data['break_weeks'] ); $break_week = array_shift( $period_data['break_weeks'] ); // Generate XSLT code for each teaching week and breaks within the period. for ( $week = $period_data['first_week']; $week <= $period_data['last_week']; $week++ ) { $week_end = clone( $week_start ); $week_end->add( $plus_four_days ); // Handle breaks. if ( ( $week >= $break_week['break_starts'] ) && ( $week <= $break_week['break_ends'] ) ) { if ( $week == $break_week['break_starts'] ) { $num_breaks++; // Work out the end date of the break. $break_end = clone( $week_start ); // Note: +4 days to get to Friday. $break_end->add( new DateInterval( sprintf( "P%dD", ( ( $break_week['break_ends'] - $break_week['break_starts'] ) * 7 ) + 4 ) ) ); switch ( $template_name ) { case 'format-teaching-date': generate_date( "B{$num_breaks}", $week_start ); break; case 'format-teaching-date-range': if ( $week_start->format( 'n' ) == $break_end->format( 'n' ) ) { generate_same_month_date_range( "B{$num_breaks}", $week_start, $break_end ); } // if break start and break end are in the same month else { generate_different_month_date_range( "B{$num_breaks}", $week_start, $break_end ); } // else break start and break end are in different months break; default: // WTF?!? print "Unrecognised template name \"$template_name\", terminating.\n"; exit; break; } // switch template name } // if current week == first week of break if ( $week == $break_week['break_ends'] ) { // Grab the next break week off the front of the list. $break_week = array_shift( $period_data['break_weeks'] ); } // if current week == last week of break } // if current week is a break week else { $week_number++; switch ( $template_name ) { case 'format-teaching-date': generate_date( $week_number, $week_start ); break; case 'format-teaching-date-range': if ( $week_start->format( 'n' ) == $week_end->format( 'n' ) ) { generate_same_month_date_range( $week_number, $week_start, $week_end ); } // if break start and break end are in the same month else { generate_different_month_date_range( $week_number, $week_start, $week_end ); } // else break start and break end are in different months break; default: // WTF?!? print "Unrecognised template name \"$template_name\", terminating.\n"; exit; break; } // switch template name } // else normal teaching week $week_start->add( $plus_seven_days ); } // for each week // Terminating boilerplate for this teaching period. print<<<EOT <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>Invalid {$period_name} week specification "</xsl:text> <xsl:value-of select="\$week" /> <xsl:text>".</xsl:text> </xsl:message> </xsl:otherwise> </xsl:choose> </xsl:when> EOT; } // foreach teaching period // Terminating boilerplate for the template. print<<<EOT </xsl:choose> </common> </template> EOT; } // generate_template //////////////////////////////////////////////////////////////////////////////// function generate_date( $week_spec, $date ) { print<<<EOT <xsl:when test="\$week = '{$week_spec}'"> <xsl:value-of select="format-date( xs:date( '{$date->format( 'Y-m-d' )}' ) + \$offset, \$format )" /> </xsl:when> EOT; } // generate_same_month_date_range //////////////////////////////////////////////////////////////////////////////// function generate_same_month_date_range( $week_spec, $start_date, $end_date ) { print<<<EOT <xsl:when test="\$week = '{$week_spec}'"> <xsl:value-of select="format-date( xs:date( '{$start_date->format( 'Y-m-d' )}' ), '[D]' )" /> <xsl:call-template name="endash" /> <xsl:value-of select="format-date( xs:date( '{$end_date->format( 'Y-m-d' )}' ), '[D] ' )" /> <xsl:if test="\$wrap"> <xsl:call-template name="newline" /> </xsl:if> <xsl:value-of select="format-date( xs:date( '{$end_date->format( 'Y-m-d' )}' ), \$month-format )" /> </xsl:when> EOT; } // generate_same_month_date_range function generate_different_month_date_range( $week_spec, $start_date, $end_date ) { print<<<EOT <xsl:when test="\$week = '{$week_spec}'"> <xsl:value-of select="format-date( xs:date( '{$start_date->format( 'Y-m-d' )}' ), concat( '[D] ', \$month-format ) )" /> <xsl:if test="\$wrap"> <xsl:call-template name="newline" /> </xsl:if> <xsl:call-template name="endash" /> <xsl:value-of select="format-date( xs:date( '{$end_date->format( 'Y-m-d' )}' ), concat( '[D] ', \$month-format ) )" /> </xsl:when> EOT; } // generate_different_month_date_range ?>
Ignore Space
Show notes
View
oracle-docs.perl
#!/usr/bin/perl # # 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: # * Maybe modify the script to work for any URL-based hyperlinks (e.g. <Blackboard/>, <OtagoUniversity/>). This would mean ditching the automatic "Ora" prefix, but wouldn't require much else to implement. # * Generalise so that the LaTeX output is split to use a separate hyperlink for each word in the link label (to allow the links to be wrapped across lines). HTML version doesn't need to be changed. # I figure this is also a sensible place to store the root of the Oracle documentation on the department's Web server. # Should this have a trailing slash (appropriate for standalone URL) or not (appropriate for a prefix for composite URLs)? $oracle_documentation_root = "http://info-nts-12.otago.ac.nz/docs/oracle11gr1/"; # 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 = ( # Name(0) Code(1) URL(2) "Documentation Docs ${oracle_documentation_root}", "Database Administrator<apostrophe />s Guide Admin ${oracle_documentation_root}server.111/b28310/toc.htm", "2 Day Developer<apostrophe />s Guide AppDev2Day ${oracle_documentation_root}appdev.111/b28843/toc.htm", "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", "Data Warehousing Guide DataWarehousing ${oracle_documentation_root}server.111/b28313/toc.htm", "Database Error Messages Errors ${oracle_documentation_root}server.111/b28278/toc.htm", "SQL Reference SQL ${oracle_documentation_root}server.111/b28286/toc.htm", "Java Developer<apostrophe />s Guide Java ${oracle_documentation_root}java.111/b31225/toc.htm", "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", "Performance Tuning Guide Tuning ${oracle_documentation_root}server.111/b28274/toc.htm", "PL/SQL Language Reference PLSQL ${oracle_documentation_root}appdev.111/b28370/toc.htm", "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" ); # 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; } $section_code = $ARGV[0]; $output_type = $ARGV[1]; if ($output_type eq "xslt") { 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"> END_OF_HEADER ; } # 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! 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> 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; } } } if ($output_type eq "xslt") { 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. # 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> 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]. " />"; } # 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>"; }
#!/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: # * Maybe modify the script to work for any URL-based hyperlinks (e.g. <Blackboard/>, <OtagoUniversity/>). This would mean ditching the automatic "Ora" prefix, but wouldn't require much else to implement. # * Generalise so that the LaTeX output is split to use a separate hyperlink for each word in the link label (to allow the links to be wrapped across lines). HTML version doesn't need to be changed. # I figure this is also a sensible place to store the root of the Oracle documentation on the department's Web server. # Should this have a trailing slash (appropriate for standalone URL) or not (appropriate for a prefix for composite URLs)? $oracle_documentation_root = "http://info-nts-12.otago.ac.nz/docs/oracle11gr1/"; # 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 = ( # Name(0) Code(1) URL(2) "Documentation Docs ${oracle_documentation_root}", "Database Administrator<apostrophe />s Guide Admin ${oracle_documentation_root}server.111/b28310/toc.htm", "2 Day Developer<apostrophe />s Guide AppDev2Day ${oracle_documentation_root}appdev.111/b28843/toc.htm", "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", "Data Warehousing Guide DataWarehousing ${oracle_documentation_root}server.111/b28313/toc.htm", "Database Error Messages Errors ${oracle_documentation_root}server.111/b28278/toc.htm", "SQL Reference SQL ${oracle_documentation_root}server.111/b28286/toc.htm", "Java Developer<apostrophe />s Guide Java ${oracle_documentation_root}java.111/b31225/toc.htm", "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", "Performance Tuning Guide Tuning ${oracle_documentation_root}server.111/b28274/toc.htm", "PL/SQL Language Reference PLSQL ${oracle_documentation_root}appdev.111/b28370/toc.htm", "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" ); # 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; } $section_code = $ARGV[0]; $output_type = $ARGV[1]; if ($output_type eq "xslt") { 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"> END_OF_HEADER ; } # 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! 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> 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; } } } if ($output_type eq "xslt") { 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. # 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> 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]. " />"; } # 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>"; }
Show line notes below