is there a possible way to check if the document() path exists using XSLT?

Viewed 41

Im using an XML as a lookup in an XSLT transformation file using the document() function to load the XML in a XSLT variable. Now if the lookup XML is missing the processor throws an error.

Is there a way to prevent or check whether the XML file is existing or not in the specified path in document() (e.g. document('c:\temp\lookup.xml') before assigning it into a variable for usage in the XSLT?

1 Answers

if the lookup XML is missing the processor throws an error.

That is conforming to the specification that states:

If there is an error retrieving the resource, then the XSLT processor may signal an error; if it does not signal an error, it must recover by returning an empty node-set.

I am not aware of any method in XSLT 1.0 that would enable you to override your processor's behavior.

Related