diff --git a/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2fo.xsl b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2fo.xsl
new file mode 100755
index 0000000..6eac1da
--- /dev/null
+++ b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2fo.xsl
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-chunks.xsl b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-chunks.xsl
new file mode 100755
index 0000000..6a6cb70
--- /dev/null
+++ b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-chunks.xsl
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-common.xsl b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-common.xsl
new file mode 100755
index 0000000..56d2b4a
--- /dev/null
+++ b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-common.xsl
@@ -0,0 +1,10 @@
+
+
+=REPO_HOME=/trunk/Identity/Webenv/Css/Docbook/default.css
+
+
+
+=REPO_HOME=/tags/Identity/Images/Webenv/1.0/
+
diff --git a/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-single.xsl b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-single.xsl
new file mode 100755
index 0000000..3579ab9
--- /dev/null
+++ b/Scripts/Functions/Render/Backends/Docbook/Xsl/docbook2xhtml-single.xsl
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/Scripts/Functions/Render/Backends/Docbook/docbook.sh b/Scripts/Functions/Render/Backends/Docbook/docbook.sh
index f98a049..ab2a503 100755
--- a/Scripts/Functions/Render/Backends/Docbook/docbook.sh
+++ b/Scripts/Functions/Render/Backends/Docbook/docbook.sh
@@ -25,6 +25,10 @@
function docbook {
+ # Initialize absolute path to Xsl directory. This is the location
+ # where customization of XSL tranformations are stored in.
+ RENDER_DOCBOOK_XSLDIR="${RENDER_BACKEND_DIR}/$(cli_getRepoName ${RENDER_BACKEND} -d)/Xsl"
+
${RENDER_BACKEND}_convertToPdf
${RENDER_BACKEND}_convertToXhtml
${RENDER_BACKEND}_convertToXhtmlChunk
diff --git a/Scripts/Functions/Render/Backends/Docbook/docbook_convertToPdf.sh b/Scripts/Functions/Render/Backends/Docbook/docbook_convertToPdf.sh
index 6fab8b6..da9eeca 100755
--- a/Scripts/Functions/Render/Backends/Docbook/docbook_convertToPdf.sh
+++ b/Scripts/Functions/Render/Backends/Docbook/docbook_convertToPdf.sh
@@ -33,6 +33,10 @@
function docbook_convertToPdf {
+ local -a XSL_TEMPLATE
+ local -a XSL_INSTANCE
+ local XSL_INSTANCE_FINAL=''
+
# Print action message.
cli_printMessage "${FILE}.pdf" --as-updating-line
@@ -50,10 +54,6 @@ function docbook_convertToPdf {
# transformation will be stored in.
local DST="${FILE}.pdf"
- # Define absolute path of the XSLT file used to create the
- # formatting object (.fo) file.
- local XSLT=/usr/share/sgml/docbook/xsl-stylesheets/fo/docbook.xsl
-
# Define file name of formatting object (.fo) file. This file is
# an intermediate file needed to produced the PDF.
local FO=$(basename ${FILE}).fo
@@ -62,6 +62,9 @@ function docbook_convertToPdf {
# for and the one moved, once produced.
local PDF=$(basename ${FILE}).pdf
+ # Prepare XSL final instances used in transformations.
+ ${RENDER_BACKEND}_prepareXsl4Using "${RENDER_DOCBOOK_XSLDIR}/docbook2fo.xsl"
+
# Verify temporal directory and create it if doesn't exist.
if [[ ! -d $TMPDIR ]];then
mkdir $TMPDIR
@@ -71,7 +74,7 @@ function docbook_convertToPdf {
pushd $TMPDIR > /dev/null
# Create formatting object supressing output from stderr.
- xsltproc ${XSLT} ${SRC} 2> /dev/null > ${FO}
+ xsltproc --output ${FO} ${XSL_INSTANCE_FINAL} ${SRC} &> /dev/null
# Create PDF format from formatting object. The `pdfxmltex' commad
# must be executed twice in order for document's cross-references
@@ -94,7 +97,8 @@ function docbook_convertToPdf {
# Return to where we initially were.
popd > /dev/null
- # Remove temporal directory.
+ # Remove temporal directory and temporal XSL instances created.
rm -r $TMPDIR
+ rm ${XSL_INSTANCE[*]}
}
diff --git a/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtml.sh b/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtml.sh
index 897a6b9..ef4ddc8 100755
--- a/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtml.sh
+++ b/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtml.sh
@@ -4,7 +4,7 @@
# as input and applies XSL stylesheets to produce a big XHTML files as
# output. The procedure was taken from the documentation of
# `docbook-style-xsl-1.69.1-5.1' package, which says: ---To publish
-# HTML from your XML documents, you just need an XSLT engine.---.
+# HTML from your XML documents, you just need an XSL engine.---.
#
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
#
@@ -28,6 +28,10 @@
function docbook_convertToXhtml {
+ local -a XSL_TEMPLATE
+ local -a XSL_INSTANCE
+ local XSL_INSTANCE_FINAL=''
+
# Print action message.
if [[ -f ${FILE}.xhtml ]];then
cli_printMessage "${FILE}.xhtml" --as-updating-line
@@ -45,10 +49,14 @@ function docbook_convertToXhtml {
# transformation will be stored in.
local DST="${FILE}.xhtml"
- # Define absolute path to XSLT file.
- local XSLT=/usr/share/sgml/docbook/xsl-stylesheets/xhtml/docbook.xsl
+ # Prepare XSL final instances used in transformations.
+ ${RENDER_BACKEND}_prepareXsl4Using $(cli_getFilesList \
+ ${RENDER_DOCBOOK_XSLDIR} --pattern='.*docbook2xhtml-(single|common)\.xsl')
# Transform DocBook XML to XHTML supressing all stderr output.
- xsltproc $XSLT --output $DST $SRC 2> /dev/null
+ xsltproc --output ${DST} ${XSL_INSTANCE_FINAL} ${SRC} &> /dev/null
+
+ # Remove XSL instance files.
+ rm ${XSL_INSTANCE[*]}
}
diff --git a/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtmlChunk.sh b/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtmlChunk.sh
index 7cf78d0..3ae5e01 100755
--- a/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtmlChunk.sh
+++ b/Scripts/Functions/Render/Backends/Docbook/docbook_convertToXhtmlChunk.sh
@@ -29,12 +29,15 @@
function docbook_convertToXhtmlChunk {
+ local -a XSL_TEMPLATE
+ local -a XSL_INSTANCE
+ local XSL_INSTANCE_FINAL=''
+
# Print action message.
if [[ -d ${FILE}-xhtml ]];then
cli_printMessage "${FILE}-xhtml" --as-updating-line
else
cli_printMessage "${FILE}-xhtml" --as-creating-line
- mkdir ${FILE}-xhtml
fi
# Define absolute path to DocBook source file. This is the
@@ -47,10 +50,14 @@ function docbook_convertToXhtmlChunk {
# transformation will be stored in.
local DST="${FILE}-xhtml/"
- # Define absolute path to XSLT file.
- local XSLT=/usr/share/sgml/docbook/xsl-stylesheets/xhtml/chunk.xsl
+ # Prepare XSL final instances used in transformations.
+ ${RENDER_BACKEND}_prepareXsl4Using $(cli_getFilesList \
+ ${RENDER_DOCBOOK_XSLDIR} --pattern='.*docbook2xhtml-(chunks|common)\.xsl')
# Transform DocBook XML to XHTML supressing all stderr output.
- xsltproc $XSLT --output $DST $SRC 2> /dev/null
+ xsltproc --output ${DST} ${XSL_INSTANCE_FINAL} ${SRC} &> /dev/null
+
+ # Remove XSL instance files.
+ rm ${XSL_INSTANCE[*]}
}
diff --git a/Scripts/Functions/Render/Backends/Docbook/docbook_prepareXsl4Using.sh b/Scripts/Functions/Render/Backends/Docbook/docbook_prepareXsl4Using.sh
new file mode 100755
index 0000000..33d1621
--- /dev/null
+++ b/Scripts/Functions/Render/Backends/Docbook/docbook_prepareXsl4Using.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# docbook_prepareXsl4Using.sh -- This function prepares XSL final
+# instances used in transformations based on XSL templates.
+#
+# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+# ----------------------------------------------------------------------
+# $Id: docbook_convertToPdf.sh 3335 2011-06-10 03:52:23Z al $
+# ----------------------------------------------------------------------
+
+function docbook_prepareXsl4Using {
+
+ local XSL_TEMPLATE_FILE=''
+ local XSL_TEMPLATE_FILES=$@
+ local COUNT=0
+
+ for XSL_TEMPLATE_FILE in $XSL_TEMPLATE_FILES;do
+
+ XSL_TEMPLATE[((++${#XSL_TEMPLATE[*]}))]="${XSL_TEMPLATE_FILE}"
+ XSL_INSTANCE[((++${#XSL_INSTANCE[*]}))]="$(cli_getTemporalFile ${XSL_TEMPLATE_FILE})"
+
+ # Keep track of array's real index value. Remember, it starts
+ # at zero but counting starts at 1 instead. So, substracting 1
+ # from counting we have the real index value we need to work
+ # with the information stored in the array.
+ COUNT=$(( ${#XSL_INSTANCE[*]} - 1 ))
+
+ # Create XSL instance from XSL template.
+ cp ${XSL_TEMPLATE[$COUNT]} ${XSL_INSTANCE[$COUNT]}
+
+ # Define the XSL final instance and expand translation markers
+ # inside it based on template files. Notice that some of the
+ # XSL template files need expantion of translation markers
+ # while others don't. Default expantion of translation markers
+ # is applied when no specific expantion is conditioned here.
+ if [[ $XSL_TEMPLATE_FILE =~ 'docbook2fo\.xsl$' ]];then
+ XSL_INSTANCE_FINAL=${XSL_INSTANCE[$COUNT]}
+ elif [[ $XSL_TEMPLATE_FILE =~ 'docbook2xhtml-(chunks|single)\.xsl$' ]];then
+ XSL_INSTANCE_FINAL=${XSL_INSTANCE[${COUNT}]}
+ sed -i -r "s!=XSL_XHTML_COMMON=!${XSL_INSTANCE_FINAL}!" ${XSL_INSTANCE_FINAL}
+ else
+ cli_replaceTMarkers ${XSL_INSTANCE[${COUNT}]}
+ fi
+
+ done
+
+ # Verify Xsl final instance before using it. We cannot continue
+ # without it.
+ cli_checkFiles $XSL_INSTANCE_FINAL
+
+}