ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahg_5.4.0.1/icdyntable.xsl

265 lines
8.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#160;">
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<!-- Copyright (c) 2004 by IBM Corporation -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- This stylesheet used by IE -->
<xsl:template match="/">
<!--TRNOTE: Translate only the lines following the TRNOTEs -->
<html>
<head>
<!-- .row {font:8pt Verdana;} -->
<style>
BODY {margin:0}
.bg {font-size:12pt; background-color:white; color:black}
H3 {font-size: 14pt; font-weight: bold}
.buttontext {font-size:8pt}
</style>
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css"/>
<link rel="stylesheet" type="text/css" href="../rzahg/ibmidwb.css"/>
</head>
<script language="javascript"><xsl:comment><![CDATA[
//START NON-TRANSLATABLE
function detectenter(e) {
var charCode = (navigator.appName == "Netscape") ? e.which : e.keyCode;
if (charCode == 13) {
subset(document.forma.intext.value)
return false;
}
}
function sort(field) {
negname = "-";
if (lastsort == "" && field == "TD1") {
negname = negname.concat(field);
lastsort = field;
deoras = 1;
sortField.value = negname;
} else {
if (lastsort == field) {
if (deoras == 1) {
lastsort = field;
sortField.value = field;
deoras = 0;
} else {
negname = negname.concat(field);
lastsort = field;
deoras = 1;
sortField.value = negname;
}
} else {
lastsort = field;
sortField.value = field;
deoras = 0;
}
}
listing.innerHTML = source.documentElement.transformNode(stylesheet);
}
function subset(field) {
if (field == "*" || field == "") {
//clear arrayData
arrayData = "";
document.forma.intext.value = "";
} else {
arrayData=arrayData.concat(" ");
arrayData = field;
}
subField.value = "isMatch(this,'" + field + "','" + arrayData + "')";
listing.innerHTML = source.documentElement.transformNode(stylesheet);
}
//END NON-TRANSLATABLE
]]></xsl:comment></script>
<script language="javascript" for="window" event="onload"><xsl:comment><![CDATA[
//START NON-TRANSLATABLE
stylesheet = document.XSLDocument;
source = document.XMLDocument;
sortField = document.XSLDocument.selectSingleNode("//@order-by");
subField = document.XSLDocument.selectSingleNode("//@expr");
lastsort = "";
deoras = 0;
arrayData = "";
//END NON-TRANSLATABLE
]]></xsl:comment></script>
<body>
<form action="SUBMIT" name="forma">
<table width="90%" cellspacing="0" style="margin-top: 0em; margin-bottom: 0em">
<tr>
<td width="10"/>
<td><h3><xsl:value-of select="TABLE/TITLE"/></h3></td>
<td><br/></td>
</tr>
<tr>
<td class="bg" width="10"/>
<!-- TRNOTE: Translate only the VALUE attributes on the INPUT tags along with the 'Search entire table for rows that contain these words' text -->
<td class="bg" nowrap=""><label for="searcher">Search entire table for rows that contain these words:</label> <input type="TEXT" size="30" name="intext" id="searcher" onKeyPress="return detectenter(event)"/> <input name="SUBMIT" type="BUTTON" value=" Filter " onClick="subset(document.forma.intext.value)"/>&nbsp;&nbsp;&nbsp;&nbsp;<input name="SUBMIT" type="BUTTON" value="Show entire table" onClick="subset('*')"/></td>
<td><br/></td></tr>
</table>
</form>
<br/>
<table width="100%" cellspacing="0" style="margin-top: 0em; margin-bottom: 0em">
<tr>
<td width="10"></td>
<td valign="top"><div id="listing"><xsl:apply-templates match="TABLE"/></div></td>
</tr>
</table>
<br/><br/>
</body>
</html>
</xsl:template>
<xsl:template match="TABLE">
<table style="background-color:#ffffff; border-style:solid; border-width:1px; border-color:#cccccc; margin-top: 0em; margin-bottom: 0em"
border="0" frame="border" cellpadding="3" width="98%" cellspacing = "1" rules="none">
<!-- <table style="background-color:white" cellpadding="3" width="98%" frame="border" cellspacing = "1" rules="none"> -->
<thead><form>
<xsl:apply-templates select="TH"/>
</form></thead>
<xsl:for-each select="TR" order-by="TD1" searchtext="*">
<xsl:if expr="isMatch(this, '*', '')">
<tr>
<xsl:if expr="isOdd()">
<xsl:attribute name="class">oddrowgrey</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="./*"/>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<!-- <hr width="100%"/> -->
<xsl:if expr="isAnyMatch()">
<!-- TRNOTE: Translate the string within the STRONG tags in the following line -->
<p><strong>No rows matched your query.</strong></p>
</xsl:if>
</xsl:template>
<xsl:template match="/TABLE/TR/*">
<td><xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute><xsl:attribute name="valign"><xsl:value-of select="@valign"/></xsl:attribute><div><!-- <div class="row"> --><xsl:apply-templates mode="arow"/></div></td>
</xsl:template>
<xsl:template match="/TABLE/TR/*//node()" mode="arow">
<xsl:copy><xsl:apply-templates select="node()|@*" mode="arow"/></xsl:copy>
</xsl:template>
<xsl:template match="TH">
<td class="interactivetablebar" valign="bottom"><table cellpadding="0" border="0" cellspacing="0" style="margin-top: 0em; margin-bottom: 0em">
<tr><td class="interactivetablebar" valign="bottom"><xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
<strong><xsl:apply-templates mode="toprow"/></strong><br/>
<button type="button" value="sort" style="height:15pt;">
<xsl:attribute name="onClick">sort("<xsl:value-of select="@col"/>")</xsl:attribute>
<font class="buttontext">Sort</font></button>
</td></tr></table></td>
</xsl:template>
<xsl:template match="/TABLE/TH//node()" mode="toprow"><xsl:copy><xsl:apply-templates select="node()|@*" mode="toprow"/></xsl:copy></xsl:template>
<xsl:script><![CDATA[
//START NON-TRANSLATABLE
evenrow = 0;
anyMatch = 0;
function isOdd() {
anyMatch = 1;
if (evenrow == 0) {
evenrow = 1;
return true;
} else {
evenrow = 0;
return false;
}
}
function isAnyMatch() {
if (anyMatch == 0) {
return true;
} else {
return false;
}
}
function isMatch(node, x, y) {
//Counts number of good hits
var a = 0;
a = parseInt(a);
if (x == "*") {
return true;
} else {
filtervalue = y.split(" ");
//Search only array elements up to indexArray
for (var k=0; k < filtervalue.length; k++) {
a = a + searchIndex(node,filtervalue[k]);
}
if (a >= filtervalue.length) {
return true;
} else {
return false;
}
//No matches found
return false;
}
}
function searchIndex(node, z) {
checkField = new Array();
inField = new Array();
numFields = 0;
spanner = 0;
x = 1;
w = 0;
y = "TD1";
tdstr = "TD";
z = z.toUpperCase();
tempField = node.selectSingleNode(y);
while (tempField != null) {
numFields = x;
inField[w] = node.selectSingleNode(y);
spanner = node.selectSingleNode(y).getAttribute("colspan");
checkField[w] = inField[w].nodeTypedValue;
checkField[w] = checkField[w].toUpperCase();
if (!isNaN(spanner)) {
if (spanner > 0) {
spanner = parseInt(spanner,10);
x = x + spanner;
} else {
x++;
}
} else {
x++;
}
y = tdstr.concat(x);
w++;
tempField = node.selectSingleNode(y);
spanner = 0;
}
for (var i=0; i < numFields; i++) {
if (checkField[i] != null) {
if (checkField[i].indexOf(z) != -1) {
return 1;
}
}
}
return 0;
}
//END NON-TRANSLATABLE
]]></xsl:script>
</xsl:stylesheet>