javascript +xsl
时间:2004-03-31
来源:互联网
function BtnInDoc(btn)
{
alert('<xsl:value-of select=btn/>');
}
作者: bigvictor 发布时间: 2004-03-31
作者: bencalie 发布时间: 2004-03-31
直接 DOM 操作
XMLDoc 和 XMLTemplate 两个对象占用系统资源
作者: snakevil 发布时间: 2004-03-31
用js直接是怎么写呢?其实我的想法很简单
<?xml version="1.0" encoding="utf-8" ?>
<?xml:stylesheet type="text/xsl" href="InDoc.xsl" ?>
<InDoc>
<Task name="零申报" ID="314" >
<Operator name="王永玲">
<Nsr name="070302010000003" state="1"/>
<Nsr name="070302010000001" state="2"/>
<Nsr name="070302020000001X" state="3"/>
</Operator>
<Operator name="韩扬">
<Nsr name="070302020000002X" state="3"/>
<Nsr name="070302020000003v" state="2"/>
<Nsr name="070302020000004r" state="1"/>
</Operator>
<Operator name="钱梓萱">
<Nsr name="070302020004444X" state="3"/>
<Nsr name="070302020022221X" state="3"/>
</Operator>
</Task>
<Task name="aaaaaa" ID="012" >
<Operator name="李剑田">
<Nsr name="070302020888881X" state="1"/>
<Nsr name="070302020009901u" state="3"/>
<Nsr name="070302020044701X" state="2"/>
</Operator>
<Operator name="王永玲">
<Nsr name="070302020000001a" state="2"/>
<Nsr name="070302020000001m" state="1"/>
<Nsr name="0703020200jjj01p" state="3"/>
</Operator>
</Task>
</InDoc>
我就是想在传过来的参数btn(这是Task中ID的值)查找一个task子节点中是否有state不等于3的存在
作者: bigvictor 发布时间: 2004-03-31
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- ====================================================================================
<xsl:variable name="selectedzone" select="//InDoc/Task[position()=1]/@name"/> -->
<xsl:variable name="selectedzone" select="//InDoc/Task/@name"/>
<!--ROOT在根节点建模板 -->
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="bm.css"/>
<title></title>
<script language="javascript">
var today = new Date();
today = today.toString().substring(0, 10);
var iIndex = 0;
var arrIDs = new Array(<xsl:value-of select="count(//InDoc/Task[@name=$selectedzone]/Operator)"/>);
function CollapseAll() {
for (var i=0; arrIDs.length > i; i++) {
resizeTable(document.all[arrIDs[i]], "C");
}
}
function ExpandAll() {
for (var i=0; arrIDs.length > i; i++) {
// alert(arrIDs[i]);
resizeTable(document.all[arrIDs[i]], "E");
}
}
function showZone(zone_id)
{
// Load XML
xml = new ActiveXObject("MSXML2.DOMDocument");
xml.async = false;
xml.load("InDoc.xml");
// Load the XSL
var xsl = new ActiveXObject("MSXML2.DOMDocument");
xsl.async = false;
xsl.load("InDoc.xsl");
document.close(); //otherwise, it was appending following to the existing page.
document.write(xml.transformNode(xsl));
}
function resizeTable(table)
{
var argv = resizeTable.arguments;
var argc = resizeTable.arguments.length;
var flagExpandCollapse = (argc > 1) ? argv[1] : "";
if (flagExpandCollapse == "") {
if (table.parentNode.style.height == "28px") {
table.parentNode.style.height = table.parentNode.style.originalHeight;
table.parentNode.style.overflow = "";
} else {
table.parentNode.style.originalHeight = table.parentNode.style.height;
table.parentNode.style.height = 28;
table.parentNode.style.overflow = "hidden";
}
} else {
if (flagExpandCollapse == "E") {
if (table.parentNode.style.height == "28px") {
table.parentNode.style.height = table.parentNode.style.originalHeight;
table.parentNode.style.overflow = "";
}
} else {
if (table.parentNode.style.height != "28px") {
table.parentNode.style.originalHeight = table.parentNode.style.height;
table.parentNode.style.height = 28;
table.parentNode.style.overflow = "hidden";
}
}
}
}
function BtnInDoc(btn)
{
//stylesheet=document.XSLDocument;
//source=Document.XMLDocument;
var s="3";
alert('<xsl:value-of select="$selectedzone"/>');
alert(btn);
}
</script>
</head>
<body topmargin="2" class="body" onload="CollapseAll();">
<xsl:apply-templates select="InDoc" />
<br/>
<div style="font-size:7pt; border-top: #dfdfdf solid 1px; color:#afafaf;">Powered by zhouaiping</div>
</body>
</html>
</xsl:template>
<!--END ROOT -->
<!-- ==================================================================================== -->
<xsl:template match="InDoc">
<xsl:apply-templates select="Task">
<xsl:with-param name="current" select="$selectedzone"/>
</xsl:apply-templates>
</xsl:template>
<!-- ==================================================================================== -->
<xsl:template match="Task">
<xsl:param name="current" select="''"/>
<div style="padding-left:10px; width:98%">
<div onclick="javascript:resizeTable(this);" style="cursor: hand; color: #6f6f6f; background-color: #e0e0e0;font-size:14pt; padding-left: 5px; zborder-bottom: #c0c0c0 solid 1px;">
<xsl:attribute name="id"><xsl:value-of select='generate-id()'/></xsl:attribute>
<script language="javascript">
arrIDs[iIndex++] = '<xsl:value-of select="generate-id()"/>';
</script>
<img border="0" src="bm.gif"/> <xsl:value-of select="@name"/>  <span style="font-size: 10pt;">(分配给<xsl:value-of select="count(child::*)"/>个评估人员)</span>
</div>
<div style="padding-left: 10px; background-color: #f0f0f0; border-top: #e0e0e0 solid 1px;">
<table style="" border="0" cellpadding="0" cellspacing="0" width="95%">
<xsl:if test="@name=$current">
<div class="zoneLinks">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" valign="top">
<xsl:apply-templates select="Operator[(position() mod 2)=1]"/>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<xsl:apply-templates select="Operator[(position() mod 2)=0]"/>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<xsl:element name="input">
<xsl:attribute name="type">button</xsl:attribute>
<xsl:attribute name="name"><xsl:value-of select="@ID"/></xsl:attribute>
<xsl:attribute name="onclick">javascript:BtnInDoc(this.name)</xsl:attribute>
<xsl:attribute name="value">加入档案夹</xsl:attribute>
</xsl:element>
</td>
</tr>
</table>
</div>
</xsl:if>
</table>
</div>
<br/>
</div>
</xsl:template>
<!-- ==================================================================================== -->
<!-- SECTIONS -->
<!-- ==================================================================================== -->
<xsl:template match="Operator">
<xsl:param name="state1" select="3"/>
<div style="padding-left:10px; width:98%">
<div onclick="javascript:resizeTable(this);" style="cursor: hand; color: #6f6f6f; background-color: #e0e0e0;font-size:14pt; padding-left: 5px; zborder-bottom: #c0c0c0 solid 1px;">
<xsl:attribute name="id"><xsl:value-of select='generate-id()'/></xsl:attribute>
<script language="javascript">
arrIDs[iIndex++] = '<xsl:value-of select="generate-id()"/>';
</script>
<img border="0" src="bm.gif"/> <xsl:value-of select="@name"/>  <span style="font-size: 10pt;">(总数为:<xsl:value-of select="count(child::*)"/>)</span><xsl:text> 有</xsl:text><xsl:value-of select="count(child::Nsr[not(@state=$state1)])"/><xsl:text>户企业未审核</xsl:text>
</div>
<div style="padding-left: 10px; background-color: #f0f0f0; border-top: #e0e0e0 solid 1px;">
<table style="" border="0" cellpadding="0" cellspacing="0" width="95%">
<xsl:apply-templates select="Nsr"/>
</table>
</div>
<br/>
</div>
</xsl:template>
<!-- ==================================================================================== -->
<xsl:template match="Nsr">
<xsl:param name="state" select="3"/>
<tr>
<td style="vertical-align:top; border-bottom: #e0e0e0 solid 1px; width:10px; padding-left:5px; padding-right:5px;" >*</td>
<td style="vertical-align:top; border-bottom: #e0e0e0 solid 1px; border-left:1px solid #d0d0d0; padding-left:5px; padding-right:5px; padding-top:1px; padding-bottom:2px;">
<a target="_blank">
<xsl:value-of select="@name"/>
</a>
</td>
<td style="vertical-align:top; border-bottom: #e0e0e0 solid 1px; border-left:1px solid #d0d0d0; padding-left:5px; padding-right:5px;">
<xsl:if test="@state=$state">
<span style="font-size: 10pt;"><xsl:text>已审核</xsl:text></span>
</xsl:if>
<xsl:if test="not(@state=$state)">
<span style="font-size: 10pt;"><xsl:text>未审核</xsl:text></span>
</xsl:if>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
作者: bigvictor 发布时间: 2004-03-31
作者: bigvictor 发布时间: 2004-03-31
XSLT 不是 php 之类的后台语言
作者: snakevil 发布时间: 2004-04-03
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28