On 09-Apr-15, at 2:16 AM, Philippe Nobili wrote:
>> --> Why dynamically switch configurations? You'll have very hard  
>> times
>> convincing us that this is really needed.
>>
> (note: This is not the need itself , just a possible solution to  
> meet the need)
>
> The need is to be able to choose between several typsetting (XSLT  
> stylesheets) styles when converting the document to PDF or HTML (our  
> main targets). Typesetting styles depend on the audience (most of it  
> is achieved using profiling) and on the publishing  constraints  
> (sometime forced to add specific banners, or fonts, or etc etc).

Why not write your own conversion scripts?

Here's mine (OS X).  I call this from a script that presents the file  
chooser dialog.  There's a fair bit of cruft in there, as I continue  
to work on it, but it should give you enough to go on...

#!/bin/bash
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ 
Home"
XEP_HOME="/Applications/XEP"
MYHOME="$PWD/Documentation_Source"

XSL_INCL="$PWD/Docbook_Support/Docbook/inclusions.xsl"
XSL_FO="$PWD/Docbook_Support/Docbook/db5_to_smallcoilbook.xsl"
XSL_TARGETS="$PWD/Docbook_Support/Docbook/docbook-xsl-ns/fo/docbook.xsl"

XML_INPATH="$1"
XML_INFILE="${1##*/}"
XML_XI1="${1%%.xml}".TEMP.1.xml
XML_XI2="${1%%.xml}".TEMP.2.xml
XML_FO="${1%%.xml}".fo
PDF_OUT="${1%%.xml}".pdf

CP="$JAVA_HOME/lib/tools.jar:\
$XEP_HOME/lib/resolver.jar:\
$XEP_HOME/lib/xercesImpl.jar:\
$XEP_HOME/lib/xep.jar:\
$XEP_HOME/lib/saxon.jar:\
$XEP_HOME/lib/xt.jar:\
$XEP_HOME/lib"

# Process <xsl:copy-of select="document()"/> inclusions
#xsltproc --xinclude -o "$XML_XI1" "$XML_INPATH" "$XML_INPATH"

# Build targets
./make_all_targets.sh

# Process inclusions, making IDs unique and removing passages that  
shouldn't be included
xsltproc --xinclude -o "$XML_XI2" "$XSL_INCL" "$XML_INPATH"

# Process using Docbook XSL:FO transformations
xsltproc \
--xinclude \
--stringparam admon.graphics.path "$MYHOME/shared_media/" \
--stringparam target.database.document "$MYHOME/targets/olinkdb.xml" \
--stringparam olink.debug "0" \
-o "$XML_FO" "$XSL_FO" "$XML_XI2"

# Convert to PDF
"$JAVA_HOME/bin/java" -Xms128m -Xmx512m -classpath "$CP" \
"-Dcom.renderx.xep.CONFIG=./Docbook_Support/xep.xml"  
com.renderx.xep.XSLDriver \
-fo "$XML_FO" -pdf "$PDF_OUT"

mv -f "$PDF_OUT" ./Final_PDFs/
rm -f "$XML_XI1" "$XML_XI2" "$XML_FO"

CONFIDENTIALITY NOTICE:  This electronic mail message and any attachment hereto 
may contain confidential information of Meyer Sound Laboratories, Incorporated 
and is intended for the personal and confidential use of the designated 
recipient(s) only.  If you are not the intended recipient (or responsible for 
delivering the message to the intended recipient), you have received this 
message in error and any review, distribution, or copying of this message or 
any attachment hereto is prohibited.  If you have received this message in 
error, please promptly notify the sender and permanently delete it from your 
computer.

Reply via email to