You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2003/07/08 12:52:17 UTC

xsl:output and outputting a Xerces DOM

By inspection, when the output is to a xerces DOM, a DOCUMENTTYPE node
is not inserted into the DOM, even if xsl:output is coded to provide a
doctype-system and doctype-public.

I realise it is optional for an implementation to do this. Is it
possible to have xalan do this as an option?
-- 
Colin Paul Adams
Preston Lancashire

Re: xsl:output and outputting a Xerces DOM

Posted by da...@us.ibm.com.



Hi Colin,

> >>>>> "david" == david n bertoni <da...@us.ibm.com> writes:
>
>     david> It's a proprietary extension, although any C++ DOM can
>     david> almost be considered proprietary, I guess.  You can still
>     david> do this with the DOM Xalan-C generates, right?
>
> The xerces DOM, yes.
>
> It's just a maintenance thing - both the transform (if I want direct
> output), and the DOM code have to be kept in line. Still, it's mostly
> just the XHTML 1.1 DTD, so it's no big deal.
>
> But couldn't xalan do the same thing automatically?

Yes and no.  When you explicitly provide a FormatterListener instance in
the XSLTResultTarget, we ignore most of the xsl:output information.  If we
didn't, then there would be no way for users to overide xsl:output, and
we'ed get complaints about that.  Also, it would require that Xalan-C
understand what sort of FormatterListener instance it's working with, which
it cannot do.  For example, the encoding attribute of xsl:output is not
relevant for a DOM FormatterListener, while it is for those that are
serializers.

Dave


Re: xsl:output and outputting a Xerces DOM

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "david" == david n bertoni <da...@us.ibm.com> writes:

    david> It's a proprietary extension, although any C++ DOM can
    david> almost be considered proprietary, I guess.  You can still
    david> do this with the DOM Xalan-C generates, right?

The xerces DOM, yes. 

It's just a maintenance thing - both the transform (if I want direct
output), and the DOM code have to be kept in line. Still, it's mostly
just the XHTML 1.1 DTD, so it's no big deal.

But couldn't xalan do the same thing automatically?
-- 
Colin Paul Adams
Preston Lancashire

Re: xsl:output and outputting a Xerces DOM

Posted by da...@us.ibm.com.



Hi Colin,

> >>>>> "david" == david n bertoni <da...@us.ibm.com> writes:
>
>     david> Hi Colin,
>
>     david> Transforming to a DOM is not really part of the standard,
>     david> so there are more than a few things that won't work.  I
>     david> don't know how we could implement this, since the DOM APIs
>     david> don't support adding a DOCTYPE node.  I think you would
>
> Hm. I am managing to do this by calling document.insertBefore (dtd,
> document.documentElement).
> This works witrh xerces-c (whether or not it is a legitimate think, I
> don't know).

It's a proprietary extension, although any C++ DOM can almost be considered
proprietary, I guess.  You can still do this with the DOM Xalan-C
generates, right?

>     david> have to do this when you create the document that you pass
>     david> to the FormatterToXercesDOM instance.  For more
>     david> information, see DOMImplementation::createDocumentType()
>     david> and DOMImplementation::createDocument()
>
> Well, since the doctype depends upon what is is the transform
> (i.e. coded on xsl:output), this is not possible (unless you
> specifically know which transform you are using, and I don't).

Yes, the typical chicken-and-egg problem.  There's no good solution, from
the DOM perspective.

Dave


Re: xsl:output and outputting a Xerces DOM

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "david" == david n bertoni <da...@us.ibm.com> writes:

    david> Hi Colin,

    david> Transforming to a DOM is not really part of the standard,
    david> so there are more than a few things that won't work.  I
    david> don't know how we could implement this, since the DOM APIs
    david> don't support adding a DOCTYPE node.  I think you would

Hm. I am managing to do this by calling document.insertBefore (dtd,
document.documentElement). 
This works witrh xerces-c (whether or not it is a legitimate think, I
don't know).

    david> have to do this when you create the document that you pass
    david> to the FormatterToXercesDOM instance.  For more
    david> information, see DOMImplementation::createDocumentType()
    david> and DOMImplementation::createDocument()

Well, since the doctype depends upon what is is the transform
(i.e. coded on xsl:output), this is not possible (unless you
specifically know which transform you are using, and I don't).
-- 
Colin Paul Adams
Preston Lancashire

Re: xsl:output and outputting a Xerces DOM

Posted by da...@us.ibm.com.



Hi Colin,

Transforming to a DOM is not really part of the standard, so there are more
than a few things that won't work.  I don't know how we could implement
this, since the DOM APIs don't  support adding a DOCTYPE node.  I think you
would have to do this when you create the document that you pass to the
FormatterToXercesDOM instance.  For more information, see
DOMImplementation::createDocumentType() and
DOMImplementation::createDocument()

Dave



|---------+--------------------------->
|         |           Colin Paul Adams|
|         |           <colin@colina.de|
|         |           mon.co.uk>      |
|         |                           |
|         |           07/08/2003 03:52|
|         |           AM              |
|---------+--------------------------->
  >-----------------------------------------------------------------------------------------------------------------|
  |                                                                                                                 |
  |        To:      xalan-c-users@xml.apache.org                                                                    |
  |        cc:      (bcc: David N Bertoni/Cambridge/IBM)                                                            |
  |        Subject: xsl:output and outputting a Xerces DOM                                                          |
  >-----------------------------------------------------------------------------------------------------------------|



By inspection, when the output is to a xerces DOM, a DOCUMENTTYPE node
is not inserted into the DOM, even if xsl:output is coded to provide a
doctype-system and doctype-public.

I realise it is optional for an implementation to do this. Is it
possible to have xalan do this as an option?
--
Colin Paul Adams
Preston Lancashire