⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newkey.htm

📁 XML path visualiser
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title ID="theTitle">Define/Modify an XSLT Key</title>
	<link  rel="stylesheet" type="text/css" href="KeyOrVar.css" > 
<script>
	var theDelim  = "\r";
	var ExistingKeys = window.dialogArguments[0];
	var mode         = window.dialogArguments[1];
	var dispName     = window.dialogArguments[2];
	var dispMatch    = window.dialogArguments[3];
	var dispUse      = window.dialogArguments[4];
	//var curFileEnteredExpressions = window.dialogArguments[4];
	window.returnValue = "";
	
</script>
</head>

<body  onload="init()">
<table>
<tr>
<td>Key Name:</td> <td><input type="Text" ID="keyName" width="300" onchange="onchangeInput()" onkeyup="onInput_KUP()"></td>
</tr>
<tr>
<td>Match:</td> <td title="Enter a pattern for the nodes to contribute for this key"><input type="Text" ID="keyMatch" size="75" onchange="onchangeInput()" onkeyup="onInput_KUP()">
</td>
</tr>
<tr>
<td>Expression:</td> <td title="Enter an expression for the matched nodes"><input type="Text" ID="exprText" size="75" onchange="onchangeInput()" onkeyup="onInput_KUP()">
</td>
</tr>
</table>
<hr/>
&nbsp;<input type="Button" value="Submit" onclick="getData()">
<div ID="ErrorMsg" class="error"></div>
<script>
function init()
{
	keyName.innerText  = dispName;
	keyMatch.innerText = dispMatch;
	exprText.innerText = dispUse;
}

function onInput_KUP()
{
	onchangeInput();
	if(event.keyCode == 13)
		getData();
}

function getData()
{
	window.returnValue = "";
	
	var varModified = 0;
	var name  = document.all("keyName").value;
	var match = document.all("keyMatch").value;
	var expr  = document.all("exprText").value;
	
	if(name == "" || match == "" || expr == "")
	{
		displayError("All fields: 'Key name', 'Match' and 'Expression' must be entered!");
		return;
	}
	
	if(mode == "new" || (mode != "new" && name != dispName))
	{
		if(isDuplicate(name))
			if(!confirm("Key name '" + name +"' already exists. Overwrite?"))
				return;
			else
				varModified = 1;
	}
	
	window.returnValue = name + theDelim + match + theDelim 
							+ expr + theDelim + varModified;
	window.close();
}

var errorDisplayed = false;
function onchangeInput()
{
	if(errorDisplayed)
	{
		ErrorMsg.innerText = "";
		ErrorMsg.style.display="none";
		errorDisplayed = false;
	}
}

function displayError(message)
{
	ErrorMsg.style.display="";
	ErrorMsg.innerText = "Error: " + message;
	errorDisplayed = true;
}

function isDuplicate(name)
{
	var name1 = name + theDelim; //padded name
	var name1Length = name1.length;
	var i;
	
	for(i = 0; i < ExistingKeys.length; i++)
	{
		var thisEntry = ExistingKeys[i];
		if(name1 == thisEntry.substr(0, name1Length))
			return 1;
	}
	return 0;
}
</script>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -