cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Koberg" <...@koberg.com>
Subject RE: "directory tree" like presentation of xml contents
Date Wed, 15 Oct 2003 18:16:30 GMT
Hi,
> 
> sorry I forgot something here. I want to present the XML in HTML.
> 

You could modify this for your needs:

<xsl:template match="lsb:page | lsb:folder | lsb:site">
  <xsl:variable name="local_name" select="local-name()"/>
  <xsl:variable name="id" select="@id"/>
  <div class="{$local_name}" lsb_type="SiteNode">
    <xsl:copy-of select="@*"/>
    <xsl:attribute name="style">
      <xsl:choose>
        <xsl:when test="$id=$restrict_idref or
parent::*/@id=$restrict_idref">
          <xsl:text>display:block;</xsl:text>
        </xsl:when>
        <xsl:otherwise>
          <xsl:text>display:none;</xsl:text>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:attribute>
    <xsl:attribute name="title">
      <xsl:value-of select="lsb:title"/>
    </xsl:attribute>
    
    <xsl:variable 
      name="child_bool" 
      select="not($local_name='page' or not(boolean(lsb:page or
lsb:folder)))"/>
    
    <div class="navHandle" id="{$id}_tggl">
      <xsl:if test="boolean($child_bool)">
        <xsl:attribute name="onclick">
          <xsl:choose>
            <xsl:when test="not($id=$restrict_idref or $local_name='page')">
              <xsl:text>top.oARCH._lsb_m_showChildren(</xsl:text>
              <xsl:value-of select="$id"/>
              <xsl:text>)</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>top.oARCH._lsb_m_hideChildren(</xsl:text>
              <xsl:value-of select="$id"/>
              <xsl:text>)</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:attribute>
      </xsl:if>
  
      <img id="{$id}_tggl_img" height="9" width="9">
        <xsl:attribute name="src">
          <xsl:choose>
            <xsl:when test="$id=$restrict_idref">
              <xsl:text>images/minus.gif</xsl:text>
            </xsl:when>
            <xsl:when test="boolean($child_bool)">
              <xsl:text>images/plus.gif</xsl:text>
            </xsl:when>
            <xsl:otherwise>
              <xsl:text>images/dot.gif</xsl:text>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:attribute>
      </img>
    </div>
    
    <div class="navImg">
      <img height="10" src="images/{$local_name}_icon.gif" width="13"/>
    </div>
    <div class="labelBlur" id="{$id}_lbl"
onclick="top.oARCH._lsb_m_setupFocus('{$id}', 1);">
      <xsl:choose>
        <xsl:when test="boolean(lsb:label)">
          <xsl:value-of select="lsb:label"/>
        </xsl:when>
        <xsl:when test="boolean(@name)">
          <xsl:value-of select="@name"/>
        </xsl:when>
        <xsl:when test="text()">
          <xsl:value-of select="normalize-space(.)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$local_name"/>
        </xsl:otherwise>
      </xsl:choose>
    </div>
    
    <xsl:apply-templates/>
  </div>
</xsl:template>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message