parameterized doctype in xsl:stylesheet

Posted by Flavius on Stack Overflow See other posts from Stack Overflow or by Flavius
Published on 2010-12-25T17:02:28Z Indexed on 2010/12/25 20:54 UTC
Read the original article Hit count: 429

Filed under:
|
|

How could I inject a --stringparam (xsltproc) into the DOCTYPE of a XSL stylesheet? The --stringparam is specified from the command line.

I have several books in docbook5 format I want to process with the same customization layer, each book having an unique identifier, here "demo", so I'm running something like

xsltproc --stringparam course.name demo ...

for each book.

Obviously the parameter is not recognized as such, but as verbatim text, giving the error:

warning: failed to load external entity "http://edu.yet-another-project.com/course/$(course.name)/entities.ent"

Here it is how I've tried, which won't work:

<?xml version='1.0'?>
<!DOCTYPE stylesheet [
<!ENTITY % myent SYSTEM "http://edu.yet-another-project.com/course/$(course.name)/entities.ent">
%myent;
]>
<xsl:stylesheet  
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">

<!-- the docbook template used -->
<xsl:import href="http://docbook.org/ns/docbook/xhtml/chunk.xsl"/>

<!-- processor parameters -->
<xsl:param name="html.stylesheet">default.css</xsl:param>
<xsl:param name="use.id.as.filename">1</xsl:param>
<xsl:param name="chunker.output.encoding">UTF-8</xsl:param>
<xsl:param name="chunker.output.indent">yes</xsl:param>
<xsl:param name="navig.graphics">1</xsl:param>
<xsl:param name="generate.revhistory.link">1</xsl:param>
<xsl:param name="admon.graphics">1</xsl:param>

<!-- here more stuff -->
</xsl:stylesheet>

Ideas?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about docbook