1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
|
<?xml version="1.0"?>
<!--
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<!-- -->
<!-- Default XSL stylesheet for use by com.lotus.xsl.server#DefaultApplyXSL. -->
<!-- -->
<!-- This stylesheet mimics the default behavior of IE when XML data is displayed -->
<!-- without a corresponding XSL stylesheet. This stylesheet uses JavaScript -->
<!-- to accommodate node expansion and contraction. -->
<!-- -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns="http://www.w3.org/TR/REC-html40">
<xsl:output method="html" indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<HTML>
<HEAD>
<STYLE type="text/css">
BODY {font:x-small 'Verdana'; margin-right:1.5em}
<!-- container for expanding/collapsing content -->
.c {cursor:hand}
<!-- button - contains +/-/nbsp -->
.b {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none}
<!-- element container -->
.e {margin-left:1em; text-indent:-1em; margin-right:1em}
<!-- comment or cdata -->
.k {margin-left:1em; text-indent:-1em; margin-right:1em}
<!-- tag -->
.t {color:#990000}
<!-- tag in xsl namespace -->
.xt {color:#990099}
<!-- attribute in xml or xmlns namespace -->
.ns {color:red}
<!-- markup characters -->
.m {color:blue}
<!-- text node -->
.tx {font-weight:bold}
<!-- multi-line (block) cdata -->
.db {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px;
padding-left:.3em; border-left:1px solid #CCCCCC; font:small Courier}
<!-- single-line (inline) cdata -->
.di {font:small Courier}
<!-- DOCTYPE declaration -->
.d {color:blue}
<!-- pi -->
.pi {color:blue}
<!-- multi-line (block) comment -->
.cb {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px;
padding-left:.3em; font:small Courier; color:#888888}
<!-- single-line (inline) comment -->
.ci {font:small Courier; color:#888888}
PRE {margin:0px; display:inline}
</STYLE>
<SCRIPT type="text/javascript"><xsl:comment><![CDATA[
// Detect and switch the display of CDATA and comments from an inline view
// to a block view if the comment or CDATA is multi-line.
function f(e)
{
// if this element is an inline comment, and contains more than a single
// line, turn it into a block comment.
if (e.className == "ci") {
if (e.children(0).innerText.indexOf("\n") > 0)
fix(e, "cb");
}
// if this element is an inline cdata, and contains more than a single
// line, turn it into a block cdata.
if (e.className == "di") {
if (e.children(0).innerText.indexOf("\n") > 0)
fix(e, "db");
}
// remove the id since we only used it for cleanup
e.id = "";
}
// Fix up the element as a "block" display and enable expand/collapse on it
function fix(e, cl)
{
// change the class name and display value
e.className = cl;
e.style.display = "block";
// mark the comment or cdata display as a expandable container
j = e.parentElement.children(0);
j.className = "c";
// find the +/- symbol and make it visible - the dummy link enables tabbing
k = j.children(0);
k.style.visibility = "visible";
k.href = "#";
}
// Change the +/- symbol and hide the children. This function works on "element"
// displays
function ch(e)
{
// find the +/- symbol
mark = e.children(0).children(0);
// if it is already collapsed, expand it by showing the children
if (mark.innerText == "+")
{
mark.innerText = "-";
for (var i = 1; i < e.children.length; i++)
e.children(i).style.display = "block";
}
// if it is expanded, collapse it by hiding the children
else if (mark.innerText == "-")
{
mark.innerText = "+";
for (var i = 1; i < e.children.length; i++)
e.children(i).style.display="none";
}
}
// Change the +/- symbol and hide the children. This function work on "comment"
// and "cdata" displays
function ch2(e)
{
// find the +/- symbol, and the "PRE" element that contains the content
mark = e.children(0).children(0);
contents = e.children(1);
// if it is already collapsed, expand it by showing the children
if (mark.innerText == "+")
{
mark.innerText = "-";
// restore the correct "block"/"inline" display type to the PRE
if (contents.className == "db" || contents.className == "cb")
contents.style.display = "block";
else contents.style.display = "inline";
}
// if it is expanded, collapse it by hiding the children
else if (mark.innerText == "-")
{
mark.innerText = "+";
contents.style.display = "none";
}
}
// Handle a mouse click
function cl()
{
e = window.event.srcElement;
// make sure we are handling clicks upon expandable container elements
if (e.className != "c")
{
e = e.parentElement;
if (e.className != "c")
{
return;
}
}
e = e.parentElement;
// call the correct funtion to change the collapse/expand state and display
if (e.className == "e")
ch(e);
if (e.className == "k")
ch2(e);
}
// Erase bogus link info from the status window
function h()
{
window.status=" ";
}
// Set the onclick handler
document.onclick = cl;
]]>//</xsl:comment></SCRIPT>
</HEAD>
<BODY class="st"><xsl:apply-templates/></BODY>
</HTML>
</xsl:template>
<!-- Templates for each node type follows. The output of each template has a similar structure
to enable script to walk the result tree easily for handling user interaction. -->
<!-- Template for pis not handled elsewhere -->
<xsl:template match="processing-instruction()">
<DIV class="e">
<SPAN class="b"> </SPAN>
<SPAN class="m"><?</SPAN><SPAN class="pi"><xsl:value-of select="name(.)"/> <xsl:value-of select="."/></SPAN><SPAN class="m">?></SPAN>
</DIV>
</xsl:template>
<!-- Template for the XML declaration. Need a separate template because the pseudo-attributes
are actually exposed as attributes instead of just element content, as in other pis
<xsl:template match="processing-instruction('xml')">
<DIV class="e">
<SPAN class="b"> </SPAN>
<SPAN class="m"><?</SPAN><SPAN class="pi">xml <xsl:for-each select="@*"><xsl:value-of select="name(.)"/>="<xsl:value-of select="."/>" </xsl:for-each></SPAN><SPAN class="m">?></SPAN>
</DIV>
</xsl:template>
-->
<!-- Template for attributes not handled elsewhere -->
<xsl:template match="@*"><SPAN class="t"><xsl:text> </xsl:text><xsl:value-of select="name(.)"/></SPAN><SPAN class="m">="</SPAN><B><xsl:value-of select="."/></B><SPAN class="m">"</SPAN></xsl:template>
<!-- Template for attributes in the xmlns or xml namespace
<xsl:template match="@xmlns:*|@xmlns|@xml:*"><SPAN class="ns"> <xsl:value-of select="name(.)"/></SPAN><SPAN class="m">="</SPAN><B class="ns"><xsl:value-of select="."/></B><SPAN class="m">"</SPAN></xsl:template>
-->
<!-- Template for text nodes -->
<xsl:template match="text()">
<xsl:choose><xsl:when test="name(.) = '#cdata-section'"><xsl:call-template name="cdata"/></xsl:when>
<xsl:otherwise><DIV class="e">
<SPAN class="b"> </SPAN>
<SPAN class="tx"><xsl:value-of select="."/></SPAN>
</DIV></xsl:otherwise></xsl:choose>
</xsl:template>
<!-- Template for comment nodes -->
<xsl:template match="comment()">
<DIV class="k">
<SPAN><A class="b" onclick="return false" onfocus="h()" STYLE="visibility:hidden">-</A> <SPAN class="m"><!--</SPAN></SPAN>
<SPAN id="clean" class="ci"><PRE><xsl:value-of select="."/></PRE></SPAN>
<SPAN class="b"> </SPAN> <SPAN class="m">--></SPAN>
<SCRIPT>f(clean);</SCRIPT></DIV>
</xsl:template>
<!-- Template for cdata nodes -->
<xsl:template name="cdata">
<DIV class="k">
<SPAN><A class="b" onclick="return false" onfocus="h()" STYLE="visibility:hidden">-</A> <SPAN class="m"><![CDATA[</SPAN></SPAN>
<SPAN id="clean" class="di"><PRE><xsl:value-of select="."/></PRE></SPAN>
<SPAN class="b"> </SPAN> <SPAN class="m">]]></SPAN>
<SCRIPT>f(clean);</SCRIPT></DIV>
</xsl:template>
<!-- Template for elements not handled elsewhere (leaf nodes) -->
<xsl:template match="*">
<DIV class="e"><DIV STYLE="margin-left:1em;text-indent:-2em">
<SPAN class="b"> </SPAN>
<SPAN class="m"><</SPAN><SPAN class="t"><xsl:value-of select="name(.)"/></SPAN> <xsl:apply-templates select="@*"/><SPAN class="m"> /></SPAN>
</DIV></DIV>
</xsl:template>
<!-- Template for elements with comment, pi and/or cdata children
<xsl:template match="*[comment() or processing-instruction() or cdata()]">
<DIV class="e">
<DIV class="c"><A href="#" onclick="return false" onfocus="h()" class="b">-</A> <SPAN class="m"><</SPAN><SPAN><xsl:attribute name="class"><xsl:if test="xsl:*">x</xsl:if>t</xsl:attribute><xsl:value-of select="name(.)"/></SPAN><xsl:apply-templates select="@*"/> <SPAN class="m">></SPAN></DIV>
<DIV><xsl:apply-templates/>
<DIV><SPAN class="b"> </SPAN> <SPAN class="m"></</SPAN><SPAN><xsl:attribute name="class"><xsl:if test="xsl:*">x</xsl:if>t</xsl:attribute><xsl:value-of select="name(.)"/></SPAN><SPAN class="m">></SPAN></DIV>
</DIV></DIV>
</xsl:template> -->
<!-- Template for elements with only text children -->
<xsl:template match="*[text() and not(comment() or processing-instruction() or *)]">
<DIV class="e"><DIV STYLE="margin-left:1em;text-indent:-2em">
<SPAN class="b"> </SPAN> <SPAN class="m"><</SPAN><SPAN class="t"><xsl:value-of select="name(.)"/></SPAN><xsl:apply-templates select="@*"/>
<SPAN class="m">></SPAN><SPAN class="tx"><xsl:value-of select="."/></SPAN><SPAN class="m"></</SPAN><SPAN class="t"><xsl:value-of select="name(.)"/></SPAN><SPAN class="m">></SPAN>
</DIV></DIV>
</xsl:template>
<!-- Template for elements with element children -->
<xsl:template match="*[*]">
<DIV class="e">
<DIV class="c" STYLE="margin-left:1em;text-indent:-2em"><A href="#" onclick="return false" onfocus="h()" class="b">-</A> <SPAN class="m"><</SPAN><SPAN class="t"><xsl:value-of select="name(.)"/></SPAN><xsl:apply-templates select="@*"/><SPAN class="m">></SPAN></DIV>
<DIV><xsl:apply-templates/>
<DIV><SPAN class="b"> </SPAN><SPAN class="m"></</SPAN><SPAN class="t"><xsl:value-of select="name(.)"/></SPAN><SPAN class="m">></SPAN></DIV>
</DIV></DIV>
</xsl:template>
</xsl:stylesheet>
|