[342793] Xsl include/import reference validation doesn't signal error on
Unresolved reference.
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java
index c79fba3..a050736 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/XSLValidator.java
@@ -232,7 +232,7 @@
String baseURI = include.getStylesheet().getFile().getLocationURI().toString();
String resolvedURI = URIResolverPlugin.createResolver().resolve(baseURI, "", att.getValue()); //$NON-NLS-1$
- if (resolvedURI == null) {
+ if ((resolvedURI == null) || (!importOrIncludeExists(stylesheetComposed.getStylesheet().getFile(), resolvedURI))) {
createMarker(
report,
att,
@@ -262,7 +262,8 @@
String baseURI = include.getStylesheet().getFile().getLocationURI().toString();
String resolvedURI = URIResolverPlugin.createResolver().resolve(baseURI, "", att.getValue()); //$NON-NLS-1$
- if (resolvedURI == null) {
+
+ if ((resolvedURI == null) || !(importOrIncludeExists(stylesheetComposed.getStylesheet().getFile(), resolvedURI))) {
createMarker(
report,
att,
@@ -286,6 +287,15 @@
}
}
+ private boolean importOrIncludeExists(IFile currentStylesheet, String resolvedURI) {
+ if (resolvedURI.startsWith("file:")) {
+ IFile file = XSLCore.resolveFile(currentStylesheet, resolvedURI);
+ return (file!=null);
+ } else {
+ return false;
+ }
+ }
+
private void checkFunctions(StylesheetModel stylesheetComposed, XSLValidationReport report) throws MaxErrorsExceededException {
for (Function function : stylesheetComposed.getStylesheet().getFunctions()) {
if (function.getName() != null) {