日期:2014-05-17 浏览次数:20538 次
<?xml-stylesheet type="text/xsl" href="filter.xsl"?>
<root>
<group name="group1">
<item id="1">item 1</item>
<item id="2">item 2</item>
</group>
<group name="group2">
<item id="1">item a</item>
<item id="2">item b</item>
</group>
</root>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/root">
<xsl:param name="GroupName" select ="(group/@name)[1]"/>
<html>
<head>
<meta content="text/html" http-equiv="Content-Type"></meta>
<script language="javascript" name="Filter">
<![CDATA[
function filter_group(sName) {
var iXml = document.XMLDocument;
var iXsl = document.XSLDocument;
//iXsl.addParameter("GroupName", sName); //
var iPara = iXsl.selectSingleNode('//xsl:param[@name="GroupName"]');
alert(iPara.text);
var iHtml = iXml.transformNode(iXsl);
document.write(iHtml);
}
]]>
</script>
</head>
<body>
<table>