stefano     2003/03/18 03:44:18

  Modified:    src/webapp/stylesheets/system xml2html.xslt
  Log:
  improved code folding for comments. tried to make it work on IE5.2 on mac but 
failed, that browser is *severely* screwed. So forget it. Even Apple is moving away 
from it.
  
  Revision  Changes    Path
  1.4       +42 -40    cocoon-2.1/src/webapp/stylesheets/system/xml2html.xslt
  
  Index: xml2html.xslt
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/stylesheets/system/xml2html.xslt,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- xml2html.xslt     17 Mar 2003 20:30:33 -0000      1.3
  +++ xml2html.xslt     18 Mar 2003 11:44:18 -0000      1.4
  @@ -52,8 +52,14 @@
       if (mark.childNodes[0].nodeValue == "+") {
           mark.childNodes[0].nodeValue = "-";
           for (var i = 1; i < e.childNodes.length; i++) {
  -            if (e.childNodes[i].nodeName != "#text") {
  -                e.childNodes[i].style.display = "block";
  +            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 == "-") {
  @@ -136,19 +142,17 @@
      <!-- match empty nodes -->
      <xsl:template match="*">
         <DIV class="e">
  -         <DIV>
  -            <SPAN class="m">&lt;</SPAN>
  -            <SPAN class="en">
  -               <xsl:value-of select="name(.)"/>
  -            </SPAN>
  -            <xsl:if test="@*">
  -               <xsl:text> </xsl:text>
  -            </xsl:if>
  -            <xsl:apply-templates select="@*"/>
  -            <SPAN class="m">
  -               <xsl:text>/></xsl:text>
  -            </SPAN>
  -         </DIV>
  +        <SPAN class="m">&lt;</SPAN>
  +        <SPAN class="en">
  +           <xsl:value-of select="name(.)"/>
  +        </SPAN>
  +        <xsl:if test="@*">
  +           <xsl:text> </xsl:text>
  +        </xsl:if>
  +        <xsl:apply-templates select="@*"/>
  +        <SPAN class="m">
  +           <xsl:text>/></xsl:text>
  +        </SPAN>
         </DIV>
      </xsl:template>
   
  @@ -187,31 +191,29 @@
   
      <xsl:template match="*[text() and not (comment() or processing-instruction())]">
         <DIV class="e">
  -         <DIV>
  -            <SPAN class="m">
  -               <xsl:text>&lt;</xsl:text>
  -            </SPAN>
  -            <SPAN class="en">
  -               <xsl:value-of select="name(.)"/>
  -            </SPAN>
  -            <xsl:if test="@*">
  -               <xsl:text> </xsl:text>
  -            </xsl:if>
  -            <xsl:apply-templates select="@*"/>
  -            <SPAN class="m">
  -               <xsl:text>></xsl:text>
  -            </SPAN>
  -            <SPAN class="t">
  -               <xsl:value-of select="."/>
  -            </SPAN>
  -            <SPAN class="m">&lt;/</SPAN>
  -            <SPAN class="en">
  -               <xsl:value-of select="name(.)"/>
  -            </SPAN>
  -            <SPAN class="m">
  -               <xsl:text>></xsl:text>
  -            </SPAN>
  -         </DIV>
  +        <SPAN class="m">
  +           <xsl:text>&lt;</xsl:text>
  +        </SPAN>
  +        <SPAN class="en">
  +           <xsl:value-of select="name(.)"/>
  +        </SPAN>
  +        <xsl:if test="@*">
  +           <xsl:text> </xsl:text>
  +        </xsl:if>
  +        <xsl:apply-templates select="@*"/>
  +        <SPAN class="m">
  +           <xsl:text>></xsl:text>
  +        </SPAN>
  +        <SPAN class="t">
  +           <xsl:value-of select="."/>
  +        </SPAN>
  +        <SPAN class="m">&lt;/</SPAN>
  +        <SPAN class="en">
  +           <xsl:value-of select="name(.)"/>
  +        </SPAN>
  +        <SPAN class="m">
  +           <xsl:text>></xsl:text>
  +        </SPAN>
         </DIV>
      </xsl:template>
   
  
  
  

Reply via email to