stephan 2002/07/12 00:29:55 Modified: . changes.xml src/webapp/samples/common/style/xsl/html simple-xml2html.xsl src/webapp/samples/hello-world/style/xsl simple-xml2html.xsl src/webapp/samples/stylesheets simple-xml2html.xsl Log: Patch 9521 applied from bugzilla to add Javascript support for the Mozilla. Revision Changes Path 1.209 +5 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.208 retrieving revision 1.209 diff -u -r1.208 -r1.209 --- changes.xml 10 Jul 2002 18:42:49 -0000 1.208 +++ changes.xml 12 Jul 2002 07:29:54 -0000 1.209 @@ -39,6 +39,10 @@ </devs> <release version="@version@" date="@date@"> + <action dev="SMS" type="update" fixes-bug="9521" due-to="Andrew Timberlake" due-to-email="[EMAIL PROTECTED]"> + Applied patch to add javascript support for the mozilla browser for transforming xml + to html. + </action> <action dev="SMS" type="update" fixes-bug="5973" due-to="Sven Kitschke" due-to-email="[EMAIL PROTECTED]"> Resolved the problem of the additional comments from used DTD's, thanks to Sven Kitschke. Problem was located in IncludeXMLConsumer and XMLByteStreamCompiler. 1.3 +161 -70 xml-cocoon2/src/webapp/samples/common/style/xsl/html/simple-xml2html.xsl Index: simple-xml2html.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/common/style/xsl/html/simple-xml2html.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- simple-xml2html.xsl 20 May 2002 06:53:16 -0000 1.2 +++ simple-xml2html.xsl 12 Jul 2002 07:29:54 -0000 1.3 @@ -6,6 +6,7 @@ | http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl | | Conversion to XSLT 1.0 REC Syntax by Steve Muench ([EMAIL PROTECTED]) + | Added script support by Andrew Timberlake ([EMAIL PROTECTED]) | +--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> @@ -16,75 +17,161 @@ <HEAD> <SCRIPT> <xsl:comment><![CDATA[ - function f(e){ - if (e.className=="ci") { - if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb"); - } - if (e.className=="di") { - if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db"); - } e.id=""; - } - function fix(e,cl){ - e.className=cl; - e.style.display="block"; - j=e.parentElement.children(0); - j.className="c"; - k=j.children(0); - k.style.visibility="visible"; - k.href="#"; - } - function ch(e) { - mark=e.children(0).children(0); - if (mark.innerText=="+") { - mark.innerText="-"; - for (var i=1;i<e.children.length;i++) { - e.children(i).style.display="block"; - } - } - else if (mark.innerText=="-") { - mark.innerText="+"; - for (var i=1;i<e.children.length;i++) { - e.children(i).style.display="none"; - } - } - } - function ch2(e) { - mark=e.children(0).children(0); - contents=e.children(1); - if (mark.innerText=="+") { - mark.innerText="-"; - if (contents.className=="db"||contents.className=="cb") { - contents.style.display="block"; - } - else { - contents.style.display="inline"; - } - } - else if (mark.innerText=="-") { - mark.innerText="+"; - contents.style.display="none"; - } - } - function cl() { - e=window.event.srcElement; - if (e.className!="c") { - e=e.parentElement; - if (e.className!="c") { - return; - } - } - e=e.parentElement; - if (e.className=="e") { - ch(e); - } - if (e.className=="k") { - ch2(e); - } - } - function ex(){} - function h(){window.status=" ";} - document.onclick=cl; - ]]> +//MSIE +function f(e){ + if (e.className=="ci") { + if (e.children(0).innerText.indexOf("\n")>0) + fix(e,"cb"); + } + if (e.className=="di") { + if (e.children(0).innerText.indexOf("\n")>0) + fix(e,"db"); + } e.id=""; +} +function fix(e,cl){ + e.className=cl; + e.style.display="block"; + j=e.parentElement.children(0); + j.className="c"; + k=j.children(0); + k.style.visibility="visible"; + k.href="#"; +} +function ch(e) { + mark=e.children(0).children(0); + if (mark.innerText=="+") { + mark.innerText="-"; + for (var i=1;i<e.children.length;i++) { + e.children(i).style.display="block"; + } + } + else if (mark.innerText=="-") { + mark.innerText="+"; + for (var i=1;i<e.children.length;i++) { + e.children(i).style.display="none"; + } + } +} +function ch2(e) { + mark=e.children(0).children(0); + contents=e.children(1); + if (mark.innerText=="+") { + mark.innerText="-"; + if (contents.className=="db"||contents.className=="cb") { + contents.style.display="block"; + } + else { + contents.style.display="inline"; + } + } + else if (mark.innerText=="-") { + mark.innerText="+"; + contents.style.display="none"; + } +} +function cl() { + e=window.event.srcElement; + if (e.className!="c") { + e=e.parentElement; + if (e.className!="c") { + return; + } + } + e=e.parentElement; + if (e.className=="e") { + ch(e); + } + if (e.className=="k") { + ch2(e); + } +} + +//mozilla +function moz_f(){ + clean=document.getElementsByName('clean'); + for(i=0; i<clean.length;i++) + { + e = clean[i]; + if (e.className=="ci") { + if (e.childNodes[1].childNodes[0].nodeValue.indexOf("\n")>0) + moz_fix(e,"cb"); + } + if (e.className=="di") { + if (e.childNodes[1].nodeValue.indexOf("\n")>0) + moz_fix(e,"db"); + } + } +} +function moz_fix(e,cl){ + e.className=cl; + e.style.display="block"; + j=e.parentNode.childNodes[1]; + j.className="c"; + k=j.childNodes[0]; + k.style.visibility="visible"; + k.href="#"; +} +function moz_ch(e) { + mark = e.childNodes[1].childNodes[1]; + + 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="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"; + } + } +} +function moz_ch2(e) { + mark = e.childNodes[1].childNodes[0]; + contents=e.childNodes[2]; + if (mark.childNodes[0].nodeValue=="+") { + mark.childNodes[0].nodeValue="-"; + if (contents.className=="db"||contents.className=="cb") { + contents.style.display="block"; + } + else { + contents.style.display="inline"; + } + } + else if (mark.childNodes[0].nodeValue=="-") { + mark.childNodes[0].nodeValue="+"; + contents.style.display="none"; + } +} + +function moz_cl(evnt) { + e=evnt.target.parentNode; + + if (e.className != "c") { + e=e.parentNode + if (e.className!="c") { + return; + } + } + e=e.parentNode + if (e.className=="e") { + moz_ch(e); + } + if (e.className=="k") { + moz_ch2(e); + } +} + +function ex(){} +function h(){window.status=" ";} +if(document.all) + document.onclick=cl; +else if(document.getElementById) + document.onclick=moz_cl; +]]> </xsl:comment> </SCRIPT> <STYLE> @@ -114,6 +201,7 @@ </STYLE> </HEAD> <BODY class="st"> + <xsl:attribute name="onload"><![CDATA[if(document.getElementsByName && !document.all){moz_f();}]]></xsl:attribute> <xsl:apply-templates/> </BODY> </HTML> @@ -175,6 +263,9 @@ <xsl:value-of select="."/> </B> <SPAN class="m">"</SPAN> + <xsl:if test="position()!=last()"> + <xsl:text> </xsl:text> + </xsl:if> </xsl:template> <xsl:template match="text()"> @@ -205,7 +296,7 @@ <SPAN class="m"> <xsl:text>--></xsl:text> </SPAN> - <SCRIPT>f(clean);</SCRIPT> + <SCRIPT>if(document.all)f(clean);</SCRIPT> </DIV> </xsl:template> 1.3 +161 -70 xml-cocoon2/src/webapp/samples/hello-world/style/xsl/simple-xml2html.xsl Index: simple-xml2html.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/hello-world/style/xsl/simple-xml2html.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- simple-xml2html.xsl 20 May 2002 06:53:16 -0000 1.2 +++ simple-xml2html.xsl 12 Jul 2002 07:29:54 -0000 1.3 @@ -6,6 +6,7 @@ | http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl | | Conversion to XSLT 1.0 REC Syntax by Steve Muench ([EMAIL PROTECTED]) + | Added script support by Andrew Timberlake ([EMAIL PROTECTED]) | +--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> @@ -16,75 +17,161 @@ <HEAD> <SCRIPT> <xsl:comment><![CDATA[ - function f(e){ - if (e.className=="ci") { - if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb"); - } - if (e.className=="di") { - if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db"); - } e.id=""; - } - function fix(e,cl){ - e.className=cl; - e.style.display="block"; - j=e.parentElement.children(0); - j.className="c"; - k=j.children(0); - k.style.visibility="visible"; - k.href="#"; - } - function ch(e) { - mark=e.children(0).children(0); - if (mark.innerText=="+") { - mark.innerText="-"; - for (var i=1;i<e.children.length;i++) { - e.children(i).style.display="block"; - } - } - else if (mark.innerText=="-") { - mark.innerText="+"; - for (var i=1;i<e.children.length;i++) { - e.children(i).style.display="none"; - } - } - } - function ch2(e) { - mark=e.children(0).children(0); - contents=e.children(1); - if (mark.innerText=="+") { - mark.innerText="-"; - if (contents.className=="db"||contents.className=="cb") { - contents.style.display="block"; - } - else { - contents.style.display="inline"; - } - } - else if (mark.innerText=="-") { - mark.innerText="+"; - contents.style.display="none"; - } - } - function cl() { - e=window.event.srcElement; - if (e.className!="c") { - e=e.parentElement; - if (e.className!="c") { - return; - } - } - e=e.parentElement; - if (e.className=="e") { - ch(e); - } - if (e.className=="k") { - ch2(e); - } - } - function ex(){} - function h(){window.status=" ";} - document.onclick=cl; - ]]> +//MSIE +function f(e){ + if (e.className=="ci") { + if (e.children(0).innerText.indexOf("\n")>0) + fix(e,"cb"); + } + if (e.className=="di") { + if (e.children(0).innerText.indexOf("\n")>0) + fix(e,"db"); + } e.id=""; +} +function fix(e,cl){ + e.className=cl; + e.style.display="block"; + j=e.parentElement.children(0); + j.className="c"; + k=j.children(0); + k.style.visibility="visible"; + k.href="#"; +} +function ch(e) { + mark=e.children(0).children(0); + if (mark.innerText=="+") { + mark.innerText="-"; + for (var i=1;i<e.children.length;i++) { + e.children(i).style.display="block"; + } + } + else if (mark.innerText=="-") { + mark.innerText="+"; + for (var i=1;i<e.children.length;i++) { + e.children(i).style.display="none"; + } + } +} +function ch2(e) { + mark=e.children(0).children(0); + contents=e.children(1); + if (mark.innerText=="+") { + mark.innerText="-"; + if (contents.className=="db"||contents.className=="cb") { + contents.style.display="block"; + } + else { + contents.style.display="inline"; + } + } + else if (mark.innerText=="-") { + mark.innerText="+"; + contents.style.display="none"; + } +} +function cl() { + e=window.event.srcElement; + if (e.className!="c") { + e=e.parentElement; + if (e.className!="c") { + return; + } + } + e=e.parentElement; + if (e.className=="e") { + ch(e); + } + if (e.className=="k") { + ch2(e); + } +} + +//mozilla +function moz_f(){ + clean=document.getElementsByName('clean'); + for(i=0; i<clean.length;i++) + { + e = clean[i]; + if (e.className=="ci") { + if (e.childNodes[1].childNodes[0].nodeValue.indexOf("\n")>0) + moz_fix(e,"cb"); + } + if (e.className=="di") { + if (e.childNodes[1].nodeValue.indexOf("\n")>0) + moz_fix(e,"db"); + } + } +} +function moz_fix(e,cl){ + e.className=cl; + e.style.display="block"; + j=e.parentNode.childNodes[1]; + j.className="c"; + k=j.childNodes[0]; + k.style.visibility="visible"; + k.href="#"; +} +function moz_ch(e) { + mark = e.childNodes[1].childNodes[1]; + + 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="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"; + } + } +} +function moz_ch2(e) { + mark = e.childNodes[1].childNodes[0]; + contents=e.childNodes[2]; + if (mark.childNodes[0].nodeValue=="+") { + mark.childNodes[0].nodeValue="-"; + if (contents.className=="db"||contents.className=="cb") { + contents.style.display="block"; + } + else { + contents.style.display="inline"; + } + } + else if (mark.childNodes[0].nodeValue=="-") { + mark.childNodes[0].nodeValue="+"; + contents.style.display="none"; + } +} + +function moz_cl(evnt) { + e=evnt.target.parentNode; + + if (e.className != "c") { + e=e.parentNode + if (e.className!="c") { + return; + } + } + e=e.parentNode + if (e.className=="e") { + moz_ch(e); + } + if (e.className=="k") { + moz_ch2(e); + } +} + +function ex(){} +function h(){window.status=" ";} +if(document.all) + document.onclick=cl; +else if(document.getElementById) + document.onclick=moz_cl; +]]> </xsl:comment> </SCRIPT> <STYLE> @@ -114,6 +201,7 @@ </STYLE> </HEAD> <BODY class="st"> + <xsl:attribute name="onload"><![CDATA[if(document.getElementsByName && !document.all){moz_f();}]]></xsl:attribute> <xsl:apply-templates/> </BODY> </HTML> @@ -175,6 +263,9 @@ <xsl:value-of select="."/> </B> <SPAN class="m">"</SPAN> + <xsl:if test="position()!=last()"> + <xsl:text> </xsl:text> + </xsl:if> </xsl:template> <xsl:template match="text()"> @@ -205,7 +296,7 @@ <SPAN class="m"> <xsl:text>--></xsl:text> </SPAN> - <SCRIPT>f(clean);</SCRIPT> + <SCRIPT>if(document.all)f(clean);</SCRIPT> </DIV> </xsl:template> 1.2 +158 -70 xml-cocoon2/src/webapp/samples/stylesheets/simple-xml2html.xsl Index: simple-xml2html.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/samples/stylesheets/simple-xml2html.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- simple-xml2html.xsl 2 Jul 2002 13:06:40 -0000 1.1 +++ simple-xml2html.xsl 12 Jul 2002 07:29:55 -0000 1.2 @@ -6,6 +6,7 @@ | http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl | | Conversion to XSLT 1.0 REC Syntax by Steve Muench ([EMAIL PROTECTED]) + | Added script support by Andrew Timberlake ([EMAIL PROTECTED]) | +--> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> @@ -16,75 +17,161 @@ <HEAD> <SCRIPT> <xsl:comment><![CDATA[ - function f(e){ - if (e.className=="ci") { - if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb"); - } - if (e.className=="di") { - if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db"); - } e.id=""; - } - function fix(e,cl){ - e.className=cl; - e.style.display="block"; - j=e.parentElement.children(0); - j.className="c"; - k=j.children(0); - k.style.visibility="visible"; - k.href="#"; - } - function ch(e) { - mark=e.children(0).children(0); - if (mark.innerText=="+") { - mark.innerText="-"; - for (var i=1;i<e.children.length;i++) { - e.children(i).style.display="block"; - } - } - else if (mark.innerText=="-") { - mark.innerText="+"; - for (var i=1;i<e.children.length;i++) { - e.children(i).style.display="none"; - } - } - } - function ch2(e) { - mark=e.children(0).children(0); - contents=e.children(1); - if (mark.innerText=="+") { - mark.innerText="-"; - if (contents.className=="db"||contents.className=="cb") { - contents.style.display="block"; - } - else { - contents.style.display="inline"; - } - } - else if (mark.innerText=="-") { - mark.innerText="+"; - contents.style.display="none"; - } - } - function cl() { - e=window.event.srcElement; - if (e.className!="c") { - e=e.parentElement; - if (e.className!="c") { - return; - } - } - e=e.parentElement; - if (e.className=="e") { - ch(e); - } - if (e.className=="k") { - ch2(e); - } - } - function ex(){} - function h(){window.status=" ";} - document.onclick=cl; - ]]> +//MSIE +function f(e){ + if (e.className=="ci") { + if (e.children(0).innerText.indexOf("\n")>0) + fix(e,"cb"); + } + if (e.className=="di") { + if (e.children(0).innerText.indexOf("\n")>0) + fix(e,"db"); + } e.id=""; +} +function fix(e,cl){ + e.className=cl; + e.style.display="block"; + j=e.parentElement.children(0); + j.className="c"; + k=j.children(0); + k.style.visibility="visible"; + k.href="#"; +} +function ch(e) { + mark=e.children(0).children(0); + if (mark.innerText=="+") { + mark.innerText="-"; + for (var i=1;i<e.children.length;i++) { + e.children(i).style.display="block"; + } + } + else if (mark.innerText=="-") { + mark.innerText="+"; + for (var i=1;i<e.children.length;i++) { + e.children(i).style.display="none"; + } + } +} +function ch2(e) { + mark=e.children(0).children(0); + contents=e.children(1); + if (mark.innerText=="+") { + mark.innerText="-"; + if (contents.className=="db"||contents.className=="cb") { + contents.style.display="block"; + } + else { + contents.style.display="inline"; + } + } + else if (mark.innerText=="-") { + mark.innerText="+"; + contents.style.display="none"; + } +} +function cl() { + e=window.event.srcElement; + if (e.className!="c") { + e=e.parentElement; + if (e.className!="c") { + return; + } + } + e=e.parentElement; + if (e.className=="e") { + ch(e); + } + if (e.className=="k") { + ch2(e); + } +} + +//mozilla +function moz_f(){ + clean=document.getElementsByName('clean'); + for(i=0; i<clean.length;i++) + { + e = clean[i]; + if (e.className=="ci") { + if (e.childNodes[1].childNodes[0].nodeValue.indexOf("\n")>0) + moz_fix(e,"cb"); + } + if (e.className=="di") { + if (e.childNodes[1].nodeValue.indexOf("\n")>0) + moz_fix(e,"db"); + } + } +} +function moz_fix(e,cl){ + e.className=cl; + e.style.display="block"; + j=e.parentNode.childNodes[1]; + j.className="c"; + k=j.childNodes[0]; + k.style.visibility="visible"; + k.href="#"; +} +function moz_ch(e) { + mark = e.childNodes[1].childNodes[1]; + + 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="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"; + } + } +} +function moz_ch2(e) { + mark = e.childNodes[1].childNodes[0]; + contents=e.childNodes[2]; + if (mark.childNodes[0].nodeValue=="+") { + mark.childNodes[0].nodeValue="-"; + if (contents.className=="db"||contents.className=="cb") { + contents.style.display="block"; + } + else { + contents.style.display="inline"; + } + } + else if (mark.childNodes[0].nodeValue=="-") { + mark.childNodes[0].nodeValue="+"; + contents.style.display="none"; + } +} + +function moz_cl(evnt) { + e=evnt.target.parentNode; + + if (e.className != "c") { + e=e.parentNode + if (e.className!="c") { + return; + } + } + e=e.parentNode + if (e.className=="e") { + moz_ch(e); + } + if (e.className=="k") { + moz_ch2(e); + } +} + +function ex(){} +function h(){window.status=" ";} +if(document.all) + document.onclick=cl; +else if(document.getElementById) + document.onclick=moz_cl; +]]> </xsl:comment> </SCRIPT> <STYLE> @@ -114,6 +201,7 @@ </STYLE> </HEAD> <BODY class="st"> + <xsl:attribute name="onload"><![CDATA[if(document.getElementsByName && !document.all){moz_f();}]]></xsl:attribute> <xsl:apply-templates/> </BODY> </HTML> @@ -208,7 +296,7 @@ <SPAN class="m"> <xsl:text>--></xsl:text> </SPAN> - <SCRIPT>f(clean);</SCRIPT> + <SCRIPT>if(document.all)f(clean);</SCRIPT> </DIV> </xsl:template>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]