diff --git a/source/com/intellij/xml/util/HtmlUtil.java b/source/com/intellij/xml/util/HtmlUtil.java
index f71ec4e36459..0557f0d159a6 100644
--- a/source/com/intellij/xml/util/HtmlUtil.java
+++ b/source/com/intellij/xml/util/HtmlUtil.java
@@ -177,8 +177,11 @@ public class HtmlUtil {
if (text.charAt(0) == '"' || text.charAt(0) == '\'') ++offset;
text = text.substring(offset,text.length() - offset);
- int hashInd = text.lastIndexOf('#');
- if (hashInd != -1) text = text.substring(0,hashInd);
+ int ind = text.lastIndexOf('#');
+ if (ind != -1) text = text.substring(0,ind);
+
+ ind = text.lastIndexOf('?');
+ if (ind!=-1) text = text.substring(0,ind);
if (text.length() > 0 && !text.startsWith("http://") && !text.startsWith("mailto:")) {
refs = new FileReferenceSet(text, element, offset, ReferenceType.FILE_TYPE, this).getAllReferences();