Collection function when XML files has a doctype
I try to user the collection function on an XSLT using saxon :
This works fine if the file has not doctype declaration.
As soon as there is one,
PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
the function does not works anymore.
A bug ?
#2 Updated by Pierre Attar about 3 years ago
It does not works means that the file is not found by the "collection" function.
So in the sample, the count function returns 0.
As soon as the doctype is removed in each file, the count function returns the right value (ie the number of *.ditamap files).
Hope this helps, Pierre
#4 Updated by Pierre Attar about 3 years ago
I've tried all on-error values plus the full removal of the parameter : the same occurs.
You are right, the DTD is not found (but how to provide a catalog ?).
My workaround for now is to put a dtd with a parameter entity going to the location of the "real" dtd.
#5 Updated by Michael Kay about 3 years ago
As far as I can see, to process each file in the collection, Saxon is passing the XMLReader the absolute URI of the document entity in the form of an absolute file:/// URI. If the DTD is referenced by an ordinary relative URI then it should therefore be located correctly.
In comment #4 I'm not sure whether to read this as saying the DTD location "map.dtd" isn't actually the true (relative) location of the DTD file? In that case you would need to use catalogs to find it. There are many ways of customising the lookup behaviour if you want to, but I'm still not clear exactly what your situation is, e.g. where the DTD is actually located.
#6 Updated by Pierre Attar almost 3 years ago
OK, now the situation is clear for me :
the dtd is defined as a relative path.
there is no catalog helping to solve the question to find where is the DTD.
So, if I use saxon in a validation mode, my documents can not be loaded. So there is no bug.
Should I suggest an error message in such a case ?
It should help to debug XSLT stylesheet when there is such a problem.
Regards and thanks for taking time for this issue,
#7 Updated by Michael Kay almost 3 years ago
- Category changed from XSLT conformance to User error
- Status changed from New to Closed
Thanks, I'm glad we've got to the bottom of this.
I'm afraid the attribute on-error=ignore is an explicit directive to ignore all files that generate errors, so it's hard to see how Saxon can override this and produce any diagnostics. Using on-error=warning would presumably give you some indication of what's wrong.
Please register to edit this issue