[239955] [translation] JSP includes within javascript tags are not validated
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPDirectiveValidator.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPDirectiveValidator.java
index 3a5fafd..e45a923 100644
--- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPDirectiveValidator.java
+++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPDirectiveValidator.java
@@ -14,6 +14,7 @@
 
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -60,6 +61,7 @@
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
 import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionCollection;
 import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
 import org.eclipse.wst.sse.core.internal.text.IRegionComparible;
 import org.eclipse.wst.sse.core.internal.validate.ValidationMessage;
@@ -67,6 +69,7 @@
 import org.eclipse.wst.validation.internal.provisional.core.IMessage;
 import org.eclipse.wst.validation.internal.provisional.core.IReporter;
 import org.eclipse.wst.validation.internal.provisional.core.IValidator;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
 
 import com.ibm.icu.text.Collator;
 
@@ -141,7 +144,7 @@
 		fAttributeNamesInUse.clear();
 	}
 
-	private void collectTaglibPrefix(IStructuredDocumentRegion documentRegion, ITextRegion valueRegion, String taglibPrefix) {
+	private void collectTaglibPrefix(ITextRegionCollection documentRegion, ITextRegion valueRegion, String taglibPrefix) {
 		fPrefixValueRegionToDocumentRegionMap.put(valueRegion, documentRegion);
 
 		Object o = fTaglibPrefixesInUse.get(taglibPrefix);
@@ -243,6 +246,16 @@
 			if (region.getType() == DOMJSPRegionContexts.JSP_DIRECTIVE_NAME) {
 				processDirective(reporter, f, sDoc, region);
 			}
+			//To check directives inside script tag.
+			else if (region.getType() == DOMRegionContext.BLOCK_TEXT) {
+				Iterator it = region.getRegions().iterator();
+				while (it.hasNext()) {
+					Object blockRegion = it.next();
+					if (blockRegion instanceof ITextRegionCollection) {
+						processDirective(reporter, f, sDoc, (ITextRegionCollection)blockRegion);
+					}
+				}
+			}
 			// requires tag name, attribute, equals, and value
 			else if (comparer != null && region.getNumberOfRegions() > 4) {
 				ITextRegion nameRegion = region.getRegions().get(1);
@@ -269,7 +282,7 @@
 		unloadPreferences();
 	}
 
-	private void processDirective(IReporter reporter, IFile file, IStructuredDocument sDoc, IStructuredDocumentRegion documentRegion) {
+	private void processDirective(IReporter reporter, IFile file, IStructuredDocument sDoc, ITextRegionCollection documentRegion) {
 		String directiveName = getDirectiveName(documentRegion);
 
 		if (directiveName.endsWith("taglib")) { //$NON-NLS-1$
@@ -293,16 +306,16 @@
 	 * Associates an ITextRegion with an IStructuredDocumentRegion 
 	 */
 	private static class RegionPair {
-		IStructuredDocumentRegion region;
+		ITextRegionCollection region;
 		ITextRegion textRegion;
 
-		RegionPair(IStructuredDocumentRegion region, ITextRegion textRegion) {
+		RegionPair(ITextRegionCollection region, ITextRegion textRegion) {
 			this.region = region;
 			this.textRegion = textRegion;
 		}
 	}
 
-	private void processAttribute(IReporter reporter, IFile file, IStructuredDocument sDoc, IStructuredDocumentRegion documentRegion) {
+	private void processAttribute(IReporter reporter, IFile file, IStructuredDocument sDoc, ITextRegionCollection documentRegion) {
 		final ITextRegion nameValueRegion = getAttributeValueRegion(documentRegion, JSP11Namespace.ATTR_NAME_NAME);
 		if (nameValueRegion != null && !hasNestedRegion(nameValueRegion)) {
 			final String nameValue = StringUtils.stripQuotes(documentRegion.getText(nameValueRegion));
@@ -324,7 +337,7 @@
 		}
 	}
 
-	private void reportUsedAttributeName(IReporter reporter, String name, IFile file, IStructuredDocumentRegion documentRegion, ITextRegion nameValueRegion, IStructuredDocument sDoc) {
+	private void reportUsedAttributeName(IReporter reporter, String name, IFile file, ITextRegionCollection documentRegion, ITextRegion nameValueRegion, IStructuredDocument sDoc) {
 		final String msgText = NLS.bind(JSPCoreMessages.JSPDirectiveValidator_12, name);
 		final LocalizedMessage message = new LocalizedMessage(fSeverityDuplicateAttributeName, msgText, file);
 		final int start = documentRegion.getStartOffset(nameValueRegion);
@@ -335,7 +348,7 @@
 		reporter.addMessage(fMessageOriginator, message);
 	}
 
-	private void processInclude(IReporter reporter, IFile file, IStructuredDocument sDoc, IStructuredDocumentRegion documentRegion, String attrName) {
+	private void processInclude(IReporter reporter, IFile file, IStructuredDocument sDoc, ITextRegionCollection documentRegion, String attrName) {
 		ITextRegion fileValueRegion = getAttributeValueRegion(documentRegion, attrName);
 		// There is a file and it isn't a nested region which could contain a JSP expression
 		if (fileValueRegion != null && !hasNestedRegion(fileValueRegion)) {
@@ -400,7 +413,7 @@
 	 * @param doc
 	 * @param documentRegion
 	 */
-	private void processPageDirective(IReporter reporter, IFile file, IStructuredDocument doc, IStructuredDocumentRegion documentRegion) {
+	private void processPageDirective(IReporter reporter, IFile file, IStructuredDocument doc, ITextRegionCollection documentRegion) {
 		ITextRegion superclassValueRegion = getAttributeValueRegion(documentRegion, JSP11Namespace.ATTR_NAME_EXTENDS);
 		if (superclassValueRegion != null) {
 			// file specified
@@ -433,7 +446,7 @@
 		}
 	}
 
-	private void processTaglibDirective(IReporter reporter, IFile file, IStructuredDocument sDoc, IStructuredDocumentRegion documentRegion) {
+	private void processTaglibDirective(IReporter reporter, IFile file, IStructuredDocument sDoc, ITextRegionCollection documentRegion) {
 		ITextRegion prefixValueRegion = null;
 		ITextRegion uriValueRegion = getAttributeValueRegion(documentRegion, JSP11Namespace.ATTR_NAME_URI);
 		ITextRegion tagdirValueRegion = getAttributeValueRegion(documentRegion, JSP20Namespace.ATTR_NAME_TAGDIR);
@@ -673,7 +686,7 @@
 				List valueRegions = (List) o;
 				String uri = null;
 				for (int regionNumber = 0; regionNumber < valueRegions.size(); regionNumber++) {
-					IStructuredDocumentRegion documentRegion = (IStructuredDocumentRegion) fPrefixValueRegionToDocumentRegionMap.get(valueRegions.get(regionNumber));
+					ITextRegionCollection documentRegion = (ITextRegionCollection) fPrefixValueRegionToDocumentRegionMap.get(valueRegions.get(regionNumber));
 					ITextRegion uriValueRegion = getAttributeValueRegion(documentRegion, JSP11Namespace.ATTR_NAME_URI);
 					if (uriValueRegion == null) {
 						uriValueRegion = getAttributeValueRegion(documentRegion, JSP20Namespace.ATTR_NAME_TAGDIR);
@@ -698,7 +711,7 @@
 					for (int regionNumber = 0; regionNumber < valueRegions.size(); regionNumber++) {
 
 						ITextRegion valueRegion = (ITextRegion) valueRegions.get(regionNumber);
-						IStructuredDocumentRegion documentRegion = (IStructuredDocumentRegion) fPrefixValueRegionToDocumentRegionMap.get(valueRegion);
+						ITextRegionCollection documentRegion = (ITextRegionCollection) fPrefixValueRegionToDocumentRegionMap.get(valueRegion);
 						LocalizedMessage message = (file == null ? new LocalizedMessage(severity, msgText) : new LocalizedMessage(severity, msgText, file));
 
 						// if there's a message, there was an error found