[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Remove DOCTYPE from XML document generated from Docbook?
Hi, In XSLT processing, more than one xsl:output element is allowed in a stylesheet and its imports. The spec says that the attributes in all the xsl:output elements are combined using import precedence into a single conceptual xsl:output. Although your xsl:output does not specify doctype-public or doctype-system attributes, those attributes are in the xsl:output element in the xhtml/docbook.xsl file that your customization imports. So that is where the DOCTYPE is coming from. To turn them off, you might think that in your customization layer you could add those two attributes and set their values to blank: <xsl:output indent="yes" encoding="utf-8" doctype-public="" doctype-system=""/> That does not work. You get: <!DOCTYPE html PUBLIC "" ""> Ugh. This is true with Saxon as well. I had a discussion with Michael Kay about this very problem, and it seems that once those attributes are set, they can't be completely unset if you want no DOCTYPE generated at all. One solution is to edit the original xhtml/docbook.xsl file that your file imports to remove those attributes from its xsl:output element. I hate having to edit the distro files, though, and sometimes you can't. This should be possible with a customization layer. Fortunately, there is a way. If you import the xhtml/onechunk.xsl stylesheet instead of xhtml/docbook.xsl, you get one output file, and you have more control over the DOCTYPE. The onechunk.xsl stylesheet uses the exsl:document() function to write the output instead of using the standard output of the xslt processor. The stylesheet controls which parameters are passed to that function. If the chunking parameters for specifying the doctypes are set to blank, then those parameters are not passed at all, and so no DOCTYPE is created. The customization looks something like this; <xsl:import href="[path-to]/docbook-xsl-ns-1.74.0/xhtml/docbook.xsl"/> <xsl:param name="chunker.output.doctype-public" select="''"/> <xsl:param name="chunker.output.doctype-system" select="''"/> <xsl:param name="chunker.output.encoding" select="'utf-8'"/> <xsl:param name="chunker.output.indent" select="'yes'"/> This will result in a single output file with no DOCTYPE. There is one other change you need to make. The default output filename for a chunked book is "index" plus the extension. You can change that on the command line by setting the stylesheet parameter "root.filename" to the output filename you expect for the given document. Basically it replaces xsltproc's -o option, but minus the filename extension. Bob Stayton Sagehill Enterprises bobs@sagehill.net ----- Original Message ----- From: "Matej Cepl" <mcepl@redhat.com> To: <docbook-apps@lists.oasis-open.org> Sent: Friday, July 11, 2008 2:57 PM Subject: [docbook-apps] Remove DOCTYPE from XML document generated from Docbook? > Hi, > > trying to produce ATOM feed from a Docbook (customized) only with > XSLT. The problem is that even though my <xsl:output> looks like > (the complete XSL stylesheet is at > http://mcepl.fedorapeople.org/tmp/atom.xsl): > > <xsl:output > indent="yes" > encoding="utf-8"/> > > xsltproc still generates HTML DOCTYPE and xmlns: > > <?xml version="1.0" encoding="utf-8" standalone="yes"?> > <!DOCTYPE atom:feed PUBLIC "-//W3C//DTD XHTML 1.0 > Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <atom:feed xmlns:atom="http://purl.org/atom/ns#" > xmlns:date="http://exslt.org/dates-and-times" > xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en" > lang="en"> > > How to avoid elimination of doctype-public and doctype-system as > they are apparently imported from the xhtml/docbook.xsl? (of > course, I know that there is no public DOCTYPE for atom). > > Best, > > Matěj Cepl > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]