<html>
<head>
<title>xslt lookup module</title>
<meta http-equiv="Content-Type" content="text/html; charset=shift_JIS">
<script src="xslt_lookupMod.js"></script>
<script language="JavaScript">
var BOOK_NAME = "O'REILLY XSLT t@X";
var KEYWORDS = new Array(
		"boolean(", "boolean() ֐", "",
		"ceiling", "ceiling() ֐", "",
		"concat", "concat() ֐", "",
		"contains", "contains() ֐", "",
		"count", "count() ֐", "",
		"current", "current() ֐", "",
		"node-set", "Datatypes", "",
		"boolean", "Datatypes", "",
		"number", "Datatypes", "",
		"string", "Datatypes", "",
		"result tree fragment", "Datatypes", "",
		"document", "document() ֐", "",
		"element-available", "element-available() ֐", "",
		"false", "false() ֐", "",
		"floor", "floor() ֐", "",
		"format-number", "format-number() ֐", "",
		"function-available", "function-available() ֐", "",
		"generate-id", "generate-id() ֐", "",
		"id", "id() ֐", "",
		"key", "key() ֐", "",
		"lang", "lang() ֐", "",
		"last", "last() ֐", "",
		"local-name", "local-name() ֐", "",
		"name(", "name() ֐", "",
		"namespace-uri", "namespace-uri() ֐", "",
		"normalize-space", "normalize-space() ֐", "",
		"not", "not() ֐", "",
		"number(", "number() ֐", "",
		"position(", "position() ֐", "",
		"round", "round() ֐", "",
		"starts-with", "starts-with() ֐", "",
		"string(", "string() ֐", "",
		"string-length", "string-length() ֐", "",
		"substring-after", "substring-after() ֐", "",
		"substring-before(", "substring-before() ֐", "",
		"substring", "substring() ֐", "",
		"sum", "sum() ֐", "",
		"system-property", "system-property() ֐", "",
		"translate", "translate() ֐", "",
		"true", "true() ֐", "",
		"unparsed-entity-uri", "unparsed-entity-uri() ֐", "",
		"child", "XPath Axes", "",
		"parent", "XPath Axes", "",
		"self", "XPath Axes", "",
		"attribute", "XPath Axes", "",
		"ancestor", "XPath Axes", "",
		"ancestor-or-self", "XPath Axes", "",
		"descendant", "XPath Axes", "",
		"descendant-or-self", "XPath Axes", "",
		"preceding-sibling", "XPath Axes", "",
		"following-sibling", "XPath Axes", "",
		"preceding", "XPath Axes", "",
		"following", "XPath Axes", "",
		"namespace", "XPath Axes", "",
		"xsl:apply-imports", "xsl:apply-imports", "",
		"xsl:apply-templates", "xsl:apply-templates", "",
		"xsl:attribute", "xsl:attribute", "",
		"xsl:attribute-set", "xsl:attribute-set", "",
		"xsl:call-template", "xsl:call-template", "",
		"xsl:choose", "xsl:choose", "",
		"xsl:comment", "xsl:comment", "",
		"xsl:copy", "xsl:copy", "",
		"xsl:copy-of", "xsl:copy-of", "",
		"xsl:decimal-format", "xsl:decimal-format", "",
		"xsl:element", "xsl:element", "",
		"xsl:fallback", "xsl:fallback", "",
		"xsl:for-each", "xsl:for-each", "",
		"xsl:if", "xsl:if", "",
		"xsl:import", "xsl:import", "",
		"xsl:include", "xsl:include", "",
		"xsl:key", "xsl:key", "",
		"xsl:message", "xsl:message", "",
		"xsl:namespace-alias", "xsl:namespace-alias", "",
		"xsl:number", "xsl:number", "",
		"xsl:otherwise", "xsl:otherwise", "",
		"xsl:output", "xsl:output", "",
		"xsl:param", "xsl:param", "",
		"xsl:preserve-space", "xsl:preserve-space", "",
		"xsl:processing-instruction", "xsl:processing-instruction", "",
		"xsl:sort", "xsl:sort", "",
		"xsl:strip-space", "xsl:strip-space", "",
		"xsl:stylesheet", "xsl:stylesheet", "",
		"xsl:template", "xsl:template", "",
		"xsl:text", "xsl:text", "",
		"xsl:transform", "xsl:transform", "",
		"xsl:value-of", "xsl:value-of", "",
		"xsl:variable", "xsl:variable", "",
		"xsl:when", "xsl:when", "",
		"xsl:with-param", "xsl:with-param", ""
		);

// XSLT Lookup Module
function referenceLookup()
{
  var xsltVal = null;
  var keyword = "";
  var dom = dw.getDocumentDOM();
  if (dom){
  		if (dom.getView() == 'design' || (dom.getView() == 'split' && dom.getFocus() != 'textView')){
			// If we're in design view and there's a tag selected, just
			// use the tagname as the keyword
			var selNode = dom.getSelectedNode();
			if (selNode != null && selNode.nodeType == Node.ELEMENT_NODE)
				keyword = selNode.tagName.toLowerCase();
			// if the selection in design view is not a tag but we're in
			// an XSLT document, default to the xsl:stylesheet topic.
			else if (dom.documentType.indexOf("XSLT") != -1)
				keyword = "xsl:stylesheet";
		}
		else {
			var docEl = dom.documentElement;
			var wholeDoc = docEl.outerHTML;
			var theSel = dom.source.getSelection();
			var startPoint = searchBackwards(theSel[0],dom);
			var endPoint = searchForwards(theSel[1],dom,wholeDoc.length);
			var j;
			keyword = dom.source.getText(startPoint,endPoint);
		}
	  	// Special cases (multiple entries for single keyword)
		if (keyword == "boolean" || keyword == "string" || keyword == "number" || keyword == "name" || keyword == "position") {
  			if (dom.source.getText(endPoint,endPoint+1) == "("){
  				keyword = keyword + "(";
  			}
  		}
		xsltVal = getTopic(keyword);
  }
	if (!xsltVal){
		xsltVal = new Array("");
	}
  return xsltVal;
}
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">

</body>
</html>
