You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Fred Toth <ft...@synernet.com> on 2003/09/16 03:55:54 UTC

No support for SAX DTDHandler() - guidance please?

Hi,

Last week I discovered that the XSLT function "unparsed-entity-uri()" does not
work in cocoon transforms.

After digging around a bit, I discovered that cocoon's SAX handlers to not 
contain
any support for the SAX DTDHandler interface which contains the methods that
are necessary to make this work. In particular "unparsedEntityDecl()" (most
important) and "notationDecl()".

I am considering adding this, and I am hoping for some guidance from developers
that are familiar with this part of the code. It seems that since both 
Xerces and
Xalan support this, it should be relatively straight forward to have 
cocoon's plumbing
"get out of the way". But I could be very wrong.

Any discussion of the topic would be helpful. I have found my way as far as the
XMLConsumer interface. I have also verified that Xerces does not require 
validation
to be turned for these events to be generated.

For those of you unfamiliar with unparsed entities, they are commonly used 
in local
DTD subsets to provide indirection for things like graphic file names. For 
example:

Given XML source like this:

<?xml version="1.0"?>
<!DOCTYPE ..." [
<!ENTITY figf1 SYSTEM "test.jpg" NDATA JPEG>
]
...
<fig entname="figf1">
...

and XSLT like this:

...
<xsl:template match="fig">
<img><xsl:attribute name="src"><xsl:value-of 
select="unparsed-entity-uri(@entname)" /></xsl:attribute></img>
</xsl:template>

I should see this in output (this works with the Xalan command line):

<img src="file:test.jpg" />

But instead, I get an empty string:

<img src="" />

As you can see, without this function there is no way to recover the original
graphic file name.

Thanks,

Fred