cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Crossley <cross...@apache.org>
Subject RE: document() function and catalog
Date Tue, 20 Apr 2004 02:12:22 GMT
David Leangen wrote:
> Joerg,
> 
> Thanks for the reply!
> 
> > > I am trying to use the document() function to "import" some data
> > > from an external XML file.
> > >
> > > I.e.: <xsl:value-of select="document('somefile.xml')/somenode"/>
> > >
> > > At the same time, I am using the catalog to resolve the DTD. However,
> > > I noticed that when using the document() function, the catalog
> > > resolver isn't used,
> >
> > That's true, the document() function does not use the catalogue
> > resolver.
> >
> > > so I actually have to hard code the location of the DTD directly
> > > into somefile.xml.
> >
> > But I do not understand how this should be related. You wrote above
> > you are already "using the catalog to resolve the DTD". Why you are
> > forced to hard code the path to the DTD?
> 
> In 'somefile.xml', I found that I have to be able to point to the DTD as
> follows:
> 
> <!DOCTYPE somenode PUBLIC "-//Some DTD//EN"
>     "some/hardcoded/path/somedtd.dtd">
> 
> The reason I have to hardcode the path is because the DTD is not located
> otherwise.

I have heard various alarms on the Cocoon lists about using
the document() function from an XSL (efficiency, caching, does not
get re-loaded if the document instance is changed, ...)

There must be a better way, using the power of Cocoon's sitemap.

Still, what you are trying to do should be able to work. I have
often tried to figure out why it will not, to no avail. Perhaps
the Xalan stylesheet processor is using a different xml parser
instance than that which is configured by Cocoon at startup.

I do know that Xalan uses the catalog entity resolver when it
processes the stylesheets. See the test at
http://localhost:8888/samples/catalog/ at the bottom of the page
produced by http://localhost:8888/samples/catalog/catalog-demo

However, it must be different when Xalan uses the document() func.

Maybe someone needs to do some research at the Xalan website
or with Google.

> Really, I have two choices: (1) to completely leave out the DTD, or (2) to
> hard-code it.

Another alternative would be to declare the DTD as an
internal subset in the head of the xml instance documents.

--David

> I don't like either choice. I want to have the DTD, but I don't want to have
> to hard-code it, either.

> 
> What happens when I don't hard-code the DTD is that the system generates a
> TransformerException (see extract of core.log below) and won't return any
> value (or maybe returns "null", which for all practical purposes is the same
> thing in this case).
> 
> In other words, <xsl:value-of select="document('somefile.xml')/somenode"/>
> returns null, when it should be returning some value.
> 
> 
> > Not that long ago someone else suggested to support the catalogues
> > in the document function, but it was not implemented since then.
> > I know that Ant supports it. Maybe someone has only to provide a
> > patch :)
> 
> Is that a hint? ;-)
> 
> If so, tell me where to look, and I'll see if I can make the time to look
> into that some day.
> 
> 
> Thanks!
> 
> 
> Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message