This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: doctype and local subset in chunked (x)html outputfrom dbxsl


On Thu, Jan 31, 2002 at 04:13:43PM +0100, Steffen Maier wrote:
> I'd like to know if it would be possible to agree on a change to the
> (x)html xslt stylesheets to allow easy customization of the chunked output
> prolog stuff like doctype or indenting?
> 
> While it is already customizable by overridung xsl:output for unchunked
> output, it is at present IMHO impossible for chunking.
> 
> What I'm thinking of are parameters like $output.doctype-public,
> $output.doctype-system and $output.indent in addition to the already
> present $output.method. (Talking about docbook-xsl-1.48.)
> 
> One solution could be to use their values as default values for the
> parameters of the named template write.chunk.with.doctype. Then substitute
> the call of write.chunk with write.chunk.with.doctype in the named
> template process-chunk within chunk.xsl. Maybe there are some more places
> that need substitution (legalnotice with titlepage.mode in titlepage.xsl,
> write.longdesc in graphics.xsl (ignoring chunk-experimental.xsl and
> oldchunker.xsl))?
> 
> For those of us who still don't want to have a doctype declaration in
> their output, do we need one more parameter as an on/off switch or is it
> sufficient to assign an empty string to both $output.doctype-public and
> $output.doctype-system?
> 
> But what if one needs a local DTD subset in his/her output? An example
> case would be a docbook document using the mathml module and containing
> MathML markup with a namespace prefix of 'mml'. The stylesheets just pass
> the nodes through. To get valid output with xhtml (only for xml-output
> MathML makes sense, i.e. not for html) the usage of a namespace prefix has
> to be declared in a local subset [mathml2, xhtml modularization]:
> 
> <!DOCTYPE html
>     PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
>            "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"; [
>     <!ENTITY % MATHML.prefixed "INCLUDE">
>     <!ENTITY % MATHML.prefix "mml">
> ]>
> 
> Inspired by calc-chunks.xsl I tried the following code fragment at the
> beginning of chunk-element-content within chunk.xsl:
> 
>   <xsl:text disable-output-escaping="yes">
>     <!-- HACK! -->
> &lt;!DOCTYPE html PUBLIC "</xsl:text><xsl:value-of
> select="$output.doctype-public"/><xsl:text disable-output-escaping="yes">"
>          "</xsl:text><xsl:value-of
> select="$output.doctype-system"/><xsl:text disable-output-escaping="yes">"
> [ 
>   ...
> ]&gt;
> </xsl:text>
> 
> Somehow it worked but it looks not very clean to me. Unfortunately this
> even collides with write.chunk.with.doctype because the xslt engine must
> not generate a doctype declaration itself now.
> 
> BTW, am I going to far with this? We still output xhtml 1.0 transitional
> (or pretend to do so ;-)) not even xhtml 1.1 so the modularization stuff
> doesn't apply? At least Mozilla renders the equations because the
> namespace is declared on the mml root element and the namespace is all it
> cares about (and wellformedness of course).

Interesting problem.  But I'm not sure I understand what
you are proposing for the extra parameters.  The
write.chunk.with.doctype template in chunker.xsl
already uses parameters for doctype-public, doctype-system,
and indent, they just aren't documented.  For example,
the exsl:document extension uses them:

      <exsl:document href="{$filename}"
                     method="{$method}"
                     encoding="{$encoding}"
                     indent="{$indent}"
                     doctype-public="{$doctype-public}"
                     doctype-system="{$doctype-system}">
        <xsl:copy-of select="$content"/>
      </exsl:document>
                  

I don't think generating a literal '<DOCTYPE>' string
fits well with the XSLT processing model.  The DOCTYPE
declaration should be generated by the extension function
that writes each chunk, from parameters that are passed to
it.  

That said, I don't see how your request to add an internal subset
to the DTD for math can be met.  That doesn't seem to
be part of the <xsl:output> model in the XSLT spec.
Here is what the spec (section 16.1) says:

"If the doctype-system attribute is specified, the xml output
method should output a document type declaration immediately
before the first element. The name following <!DOCTYPE
should be the name of the first element. If doctype-public
attribute is also specified, then the xml output method
should output PUBLIC followed by the public identifier and
then the system identifier; otherwise, it should output
SYSTEM followed by the system identifier. The internal
subset should be empty. The doctype-public attribute should
be ignored unless the doctype-system attribute is specified."

It looks like you can avoid outputting any DOCTYPE by not
specifying a doctype-system.  But the statement that
"The internal subset should be empty" is rather
definitive, even if it doesn't say why!


Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]