Blame Scripts/Functions/Render/Docbook/docbook_convertToXhtml.sh

e8c00e
#!/bin/bash
e8c00e
#
bcfc42
# docbook_convertToXhtml.sh -- This function uses DocBook XML as input
bcfc42
# and applies XSL stylesheets to produce a big XHTML files as output.
bcfc42
# The procedure was taken from the documentation of
e8906a
# `docbook-style-xsl-1.69.1-5.1' package, which says: ---To publish
be62ec
# HTML from your XML documents, you just need an XSL engine.---.
e8c00e
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
e8c00e
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
e8c00e
# General Public License for more details.
e8c00e
#
e8c00e
# You should have received a copy of the GNU General Public License
e8c00e
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
e8c00e
# ----------------------------------------------------------------------
e8c00e
# $Id$
e8c00e
# ----------------------------------------------------------------------
e8c00e
e8906a
function docbook_convertToXhtml {
e8c00e
2fa604
    local -a STYLE_TEMPLATE
2fa604
    local -a STYLE_INSTANCE
2fa604
    local STYLE_INSTANCE_FINAL=''
be62ec
e8c00e
    # Print action message.
e8c00e
    if [[ -f ${FILE}.xhtml ]];then
0ff158
        cli_printMessage "${FILE}.xhtml" --as-updating-line
e8c00e
    else
0ff158
        cli_printMessage "${FILE}.xhtml" --as-creating-line
e8c00e
    fi
e8c00e
e8906a
    # Define absolute path to DocBook source file. This is the
e8906a
    # repository documentation manual file where DOCTYPE and ENTITY
e8906a
    # definition lines are set.
e8906a
    local SRC=${INSTANCE}
e8c00e
e8906a
    # Define absolute path to PDF target file. This is the final
e8906a
    # location the PDF file produced as result of DocBook to PDF
e8906a
    # transformation will be stored in.
e8906a
    local DST="${FILE}.xhtml"
e8906a
be62ec
    # Prepare XSL final instances used in transformations.
2fa604
    ${RENDER_BACKEND}_prepareStyles $(cli_getFilesList \
2fa604
        ${DOCBOOK_STYLES_DIR} --pattern='.*docbook2xhtml-(single|common)\.xsl')
e8906a
e8906a
    # Transform DocBook XML to XHTML supressing all stderr output.
2fa604
    xsltproc --output ${DST} ${STYLE_INSTANCE_FINAL} ${SRC} &> /dev/null
be62ec
be62ec
    # Remove XSL instance files.
2fa604
    rm ${STYLE_INSTANCE[*]}
e8c00e
e8c00e
}