[xml] multiple xsl:output declarations don't allow unsetting doctype-*
- From: Peter Pawlowski <pawlowski vivisimo com>
- To: xml gnome org
- Cc: Christian Höltje <holtje vivisimo com>
- Subject: [xml] multiple xsl:output declarations don't allow unsetting doctype-*
- Date: Mon, 03 Nov 2008 11:55:44 -0500
I wasn't able to find anything about this issue in the archives or bug
tracking:
I have an XSL stylesheet with two xsl:output elements, and I wish I
could have the second xsl:output "override" the declaration of doctype
on the first one. See below [1] for a simplified snippet of my XSL code
(and libxslt version number).
The XSL spec is a little unclear (to me) on the behavior in this case
[2], suggesting "the effective value is the specified value with the
highest import precedence". Since the doctype-public on the first
xsl:output element is the only specified value, the behavior of xsltproc
seems to follow the spec. However it leaves me with no way of overriding
an imported xsl:output method's doctype declaration elsewhere in the
stylesheet...
I will probably code up a patch to xsltproc to have empty string do the
override (i.e. doctype-public=""), since we need this to work in our
software.
Does anyone have a better idea, or other interpretation or advice? Or is
anyone interested in my patch?
Thanks for any help you can offer!
-Peter
[1] My simplified stylesheet:
====
<?xml version="1.0" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
>
<xsl:output method="html"
doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
/>
<xsl:output method="xml" />
<xsl:template match="/">
<foo />
</xsl:template>
</xsl:stylesheet>
====
generates the following output:
====
[pawlowski dev3 libxslt-1.1.24]$ ./xsltproc/xsltproc t t
<?xml version="1.0"?>
<!DOCTYPE foo PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<foo/>
[pawlowski dev3 libxslt-1.1.24]$ ./xsltproc/xsltproc --version
Using libxml 20702, libxslt 10124 and libexslt 813
xsltproc was compiled against libxml 20702, libxslt 10124 and libexslt 813
libxslt 10124 was compiled against libxml 20702
libexslt 813 was compiled against libxml 20702
====
[2] http://www.w3.org/TR/xslt#output
"A stylesheet may contain multiple xsl:output elements and may include
or import stylesheets that also contain xsl:output elements. All the
xsl:output elements occurring in a stylesheet are merged into a single
effective xsl:output element. For the cdata-section-elements attribute,
the effective value is the union of the specified values. For other
attributes, the effective value is the specified value with the highest
import precedence. It is an error if there is more than one such value
for an attribute. An XSLT processor may signal the error; if it does not
signal the error, if should recover by using the value that occurs last
in the stylesheet. The values of attributes are defaulted after the
xsl:output elements have been merged; different output methods may have
different default values for an attribute."
--
PETER PAWLOWSKI
Senior Software Engineer
pawlowski vivisimo com
Vivisimo [Search Done Right]
1710 Murray Avenue
Pittsburgh, PA 15217 USA
tel: +1.412.422.2499 x116
fax: +1.412.422.2495
vivisimo.com clusty.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]