Author: antonio Date: Sun Nov 28 21:55:51 2004 New Revision: 106890 URL: http://svn.apache.org/viewcvs?view=rev&rev=106890 Log: Bug#30043: [PATCH] xml2html.xslt does not work on IE Added: cocoon/trunk/src/webapp/resources/scripts/prettycontent.js cocoon/trunk/src/webapp/resources/styles/prettycontent.css Modified: cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt cocoon/trunk/status.xml
Modified: cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt?view=diff&rev=106890&p1=cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt&r1=106889&p2=cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt&r2=106890 ============================================================================== --- cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt (original) +++ cocoon/trunk/src/blocks/scratchpad/samples/sitemap-viewer/transforms/xml2html.xslt Sun Nov 28 21:55:51 2004 @@ -22,71 +22,18 @@ | Conversion to XSLT 1.0 REC Syntax by Steve Muench ([EMAIL PROTECTED]) | Added script support by Andrew Timberlake ([EMAIL PROTECTED]) | Cleaned up and ported to standard DOM by Stefano Mazzocchi ([EMAIL PROTECTED]) - | Changed the right margin for SitmapViewer by Jelle Alten + | Changed the right margin for SitmapViewer by Jelle Alten | | CVS $Id: xml2html.xslt,v 1.2 2004/03/06 02:25:37 antonio Exp $ +--> - + <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <HTML> <HEAD> - <STYLE> - BODY {background-color: white; color: black; font: monospace;} - .b {cursor:pointer; color:red; font-weight:bold; text-decoration:none} - .e {border: 0px; padding: 0px; margin: 0px 0px 0px 2em; text-indent:-1em;} - .en {color:#000088; font-weight:bold;} - .an {color:#880000} - .av {color:#888888} - .c {color:#008800} - .t {color:black} - .m {color:navy} - .pi {color:red} - PRE {margin:0px; display:inline} - DIV {border:0; padding:0; margin:0;} - </STYLE> - <SCRIPT><xsl:comment><![CDATA[ - -function click(event) { - - var mark = event.target; - - while ((mark.className != "b") && (mark.nodeName != "BODY")) { - mark = mark.parentNode - } - - var e = mark; - - while ((e.className != "e") && (e.nodeName != "BODY")) { - e = e.parentNode - } - - if (mark.childNodes[0].nodeValue == "+") { - mark.childNodes[0].nodeValue = "-"; - for (var i = 2; i < e.childNodes.length; i++) { - var name = e.childNodes[i].nodeName; - if (name != "#text") { - if (name == "PRE" || name == "SPAN") { - window.status = "inline"; - e.childNodes[i].style.display = "inline"; - } else { - e.childNodes[i].style.display = "block"; - } - } - } - } else if (mark.childNodes[0].nodeValue == "-") { - mark.childNodes[0].nodeValue = "+"; - for (var i = 2; i < e.childNodes.length; i++) { - if (e.childNodes[i].nodeName != "#text") { - e.childNodes[i].style.display = "none"; - } - } - } -} - -]]></xsl:comment> - </SCRIPT> + <link href="/styles/prettycontent.css" type="text/css" rel="stylesheet"/> + <script src="/scripts/prettycontent.js" type="text/javascript"/> </HEAD> <BODY> <xsl:apply-templates/> @@ -122,7 +69,7 @@ <!-- match comments --> <xsl:template match="comment()"> <DIV class="e"> - <SPAN class="b" onclick="click(event)">-</SPAN> + <SPAN class="b" onclick="xml2htmlToggle(event)">-</SPAN> <SPAN class="m"> <xsl:text><!--</xsl:text> </SPAN> @@ -151,7 +98,7 @@ <xsl:text> </xsl:text> </xsl:if> </xsl:template> - + <!-- match empty nodes --> <xsl:template match="*"> <DIV class="e"> @@ -172,7 +119,7 @@ <xsl:template match="*[node()]"> <DIV class="e"> <DIV> - <SPAN class="b" onclick="click(event)">-</SPAN> + <SPAN class="b" onclick="xml2htmlToggle(event)">-</SPAN> <SPAN class="m"><</SPAN> <SPAN class="en"> <xsl:value-of select="name(.)"/> @@ -233,7 +180,7 @@ <xsl:template match="*[*]" priority="20"> <DIV class="e"> <DIV> - <SPAN class="b" onclick="click(event)">-</SPAN> + <SPAN class="b" onclick="xml2htmlToggle(event)">-</SPAN> <SPAN class="m"><</SPAN> <SPAN class="en"> <xsl:value-of select="name(.)"/> Added: cocoon/trunk/src/webapp/resources/scripts/prettycontent.js Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/resources/scripts/prettycontent.js?view=auto&rev=106890 ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/resources/scripts/prettycontent.js Sun Nov 28 21:55:51 2004 @@ -0,0 +1,66 @@ +/* +* Copyright 1999-2004 The Apache Software Foundation +* +* Licensed 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. +*/ +function xml2htmlToggle(event) { + + var mark; + if (event.srcElement) { + mark = event.srcElement; + } else { + mark = event.target; + } + + while ((mark.className != "b") && (mark.nodeName != "BODY")) { + mark = mark.parentNode + } + + var e = mark; + + while ((e.className != "e") && (e.nodeName != "BODY")) { + e = e.parentNode + } + + if (mark.childNodes[0].nodeValue == "+") { + mark.childNodes[0].nodeValue = "-"; + var starthiding = false; + for (var i = 0; i < e.childNodes.length; i++) { + var name = e.childNodes[i].nodeName; + if (name != "#text") { + if (starthiding) { + if (name == "PRE" || name == "SPAN") { + window.status = "inline"; + e.childNodes[i].style.display = "inline"; + } else { + e.childNodes[i].style.display = "block"; + } + } else { + starthiding = true; + } + } + } + } else if (mark.childNodes[0].nodeValue == "-") { + mark.childNodes[0].nodeValue = "+"; + var starthiding = false; + for (var i = 0; i < e.childNodes.length; i++) { + if (e.childNodes[i].nodeName != "#text") { + if (starthiding) { + e.childNodes[i].style.display = "none"; + } else { + starthiding = true; + } + } + } + } +} Added: cocoon/trunk/src/webapp/resources/styles/prettycontent.css Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/resources/styles/prettycontent.css?view=auto&rev=106890 ============================================================================== --- (empty file) +++ cocoon/trunk/src/webapp/resources/styles/prettycontent.css Sun Nov 28 21:55:51 2004 @@ -0,0 +1,27 @@ +/* +* Copyright 1999-2004 The Apache Software Foundation +* +* Licensed 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. +*/ +BODY {background-color: white; color: black; font-family: monospace;} +.b {cursor:pointer; color:red; font-weight:bold; text-decoration:none; padding-right: 2px;} +.e {border: 0px; padding: 0px; margin: 0px 0px 0px 2em; text-indent:-1em;} +.en {color:#000088; font-weight:bold;} +.an {color:#880000} +.av {color:#888888} +.c {color:#008800} +.t {color:black} +.m {color:navy} +.pi {color:red} +PRE {margin:0px; display:inline} +DIV {border:0; padding:0; margin:0;} \ No newline at end of file Modified: cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt?view=diff&rev=106890&p1=cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt&r1=106889&p2=cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt&r2=106890 ============================================================================== --- cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt (original) +++ cocoon/trunk/src/webapp/stylesheets/system/xml2html.xslt Sun Nov 28 21:55:51 2004 @@ -25,74 +25,21 @@ | | CVS $Id: xml2html.xslt,v 1.10 2004/05/01 13:20:55 joerg Exp $ +--> - + <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <HTML> - <xsl:call-template name="head"/> + <HEAD> + <link href="/styles/prettycontent.css" type="text/css" rel="stylesheet"/> + <script src="/scripts/prettycontent.js" type="text/javascript"/> + </HEAD> <BODY> <xsl:apply-templates/> </BODY> </HTML> </xsl:template> - <xsl:template name="head"> - <HEAD> - <STYLE> - BODY {background-color: white; color: black; font-family: monospace;} - .b {cursor:pointer; color:red; font-weight:bold; text-decoration:none; padding-right: 2px;} - .e {border: 0px; padding: 0px; margin: 0px 0px 0px 2em; text-indent:-1em;} - .en {color:#000088; font-weight:bold;} - .an {color:#880000} - .av {color:#888888} - .c {color:#008800} - .t {color:black} - .m {color:navy} - .pi {color:red} - PRE {margin:0px; display:inline} - DIV {border:0; padding:0; margin:0;} - </STYLE> - <SCRIPT><xsl:comment><![CDATA[ -function click(event) { - - var mark = event.target; - while ((mark.className != "b") && (mark.nodeName != "BODY")) { - mark = mark.parentNode - } - - var e = mark; - while ((e.className != "e") && (e.nodeName != "BODY")) { - e = e.parentNode - } - - if (mark.childNodes[0].nodeValue == "+") { - mark.childNodes[0].nodeValue = "-"; - for (var i = 2; i < e.childNodes.length; i++) { - var name = e.childNodes[i].nodeName; - if (name != "#text") { - if (name == "PRE" || name == "SPAN") { - window.status = "inline"; - e.childNodes[i].style.display = "inline"; - } else { - e.childNodes[i].style.display = "block"; - } - } - } - } else if (mark.childNodes[0].nodeValue == "-") { - mark.childNodes[0].nodeValue = "+"; - for (var i = 2; i < e.childNodes.length; i++) { - if (e.childNodes[i].nodeName != "#text") { - e.childNodes[i].style.display = "none"; - } - } - } -} -]]></xsl:comment> - </SCRIPT> - </HEAD> - </xsl:template> - <!-- match processing instructions --> <xsl:template match="processing-instruction()"> <DIV class="e"> @@ -118,7 +65,7 @@ <!-- match comments --> <xsl:template match="comment()"> <DIV class="e"> - <SPAN class="b" onclick="click(event)">-</SPAN> + <SPAN class="b" onclick="xml2htmlToggle(event)">-</SPAN> <SPAN class="m"><!--</SPAN> <SPAN class="c"> <PRE> @@ -143,7 +90,7 @@ <xsl:text> </xsl:text> </xsl:if> </xsl:template> - + <!-- match empty elements --> <xsl:template match="*[not(node())]"> <DIV class="e"> @@ -191,7 +138,7 @@ <xsl:template match="*[node()]"> <DIV class="e"> <DIV> - <SPAN class="b" onclick="click(event)">-</SPAN> + <SPAN class="b" onclick="xml2htmlToggle(event)">-</SPAN> <SPAN class="m"><</SPAN> <SPAN class="en"> <xsl:value-of select="name(.)"/> Modified: cocoon/trunk/status.xml Url: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&rev=106890&p1=cocoon/trunk/status.xml&r1=106889&p2=cocoon/trunk/status.xml&r2=106890 ============================================================================== --- cocoon/trunk/status.xml (original) +++ cocoon/trunk/status.xml Sun Nov 28 21:55:51 2004 @@ -431,6 +431,9 @@ </action> </release> <release version="2.1.7" date="TBD"> + <action dev="AG" type="fix" fixes-bug="30043" due-to="Micah Dubinko" due-to-email="[EMAIL PROTECTED]"> + xml2html.xslt does not work on IE. + </action> <action dev="RG" type="fix" fixes-bug="32417"> Portal: attributes "javax.portlet.request" and "javax.portlet.response" were not set for JSR-168 portlets running in the Cocoon webapp.