Project

Profile

Help

Bug #2933

closed

Collection function when XML files has a doctype

Added by Pierre Attar about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
User error
Sprint/Milestone:
Start date:
2016-09-12
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hi,

I try to user the collection function on an XSLT using saxon :

xsl:message select="count(collection('file:///O:/data/Donnees/trunk/sources/modules/?select=*.ditamap;recurse=no;on-error=ignore'))"/></xsl:message>

This works fine if the file has not doctype declaration.

As soon as there is one,

the function does not works anymore.

A bug ?

Regards, Pierre

Actions #1

Updated by Michael Kay about 8 years ago

When you say it doesn't work, could you explain how it fails?

And when you say it doesn't work "any more", could you say when it did work?

Actions #2

Updated by Pierre Attar about 8 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

Actions #3

Updated by Michael Kay about 8 years ago

If you remove the on-error=ignore, what diagnostics do you get?

(I'm assuming that for some reason the DTD isn't being found, and that on-error=ignore means you get no information about the cause, the file is simply skipped.)

Actions #4

Updated by Pierre Attar about 8 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.

Actions #5

Updated by Michael Kay about 8 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.

Actions #6

Updated by Pierre Attar about 8 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,

Pierre

Actions #7

Updated by Michael Kay about 8 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

Also available in: Atom PDF