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?
From http://www.w3.org/TR/xslt#output
So, when using XSLT 1.0 you can’t parameterize public nor system DOCTYPE strings.
From http://www.w3.org/TR/xslt20/#element-result-document
In XSLT 2.0 you can use
xsl:result-documentinstruction for that task.