RE: [xsl] Trying to read a parameter in the request in a XSL file

Subject: RE: [xsl] Trying to read a parameter in the request in a XSL file
From: "Robert Koberg" <rob@xxxxxxxxxx>
Date: Fri, 3 Oct 2003 14:06:44 -0700
Hi,

I am going to assume you want to give this view so people can easily see the
site structure and to assure it makes sense. If that is so, then I would
avoid using element names like level1, level2, leveln. If they see it and
want to change things around you will have to back and rename your elements
rather than simply moving nodes.

That being said, we use something like:

<site>
 <folder>
   <page/>
   <page/>
    <folder>
      <page/>
      <page/>
    </folder>
 </folder>
</site>

Here is an XSL that creates a tree similar to what I think you want. It uses
different element names and attrs than you describe but hopefully you can
extract what you need.

Best,
-Rob

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:lsb="http://livestoryboard.com/lsb/schemas/2003/03/config";>
  <xsl:output method="html" encoding="utf-8" indent="yes"/>
  <xsl:template match="/">
    <html>
      <head>
        <title>Navigation</title>
        <style type="text/css" media="all">
           @import "css/nav.css";
        </style>
      </head>
      <body>
        <form id="nav_form" action="DisplayNav" method="post"/>
        <xsl:apply-templates/>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="lsb:page | lsb:folder | lsb:site">
    <xsl:variable name="local_name" select="local-name()"/>
    <div class="{$local_name}" lsb_type="SiteNode">
      <xsl:copy-of select="@*"/>
      <xsl:variable name="id" select="@id"/>
      <xsl:attribute name="style">
        <xsl:text>display:block;</xsl:text>
      </xsl:attribute>
      <xsl:attribute name="title">
        <xsl:value-of select="lsb:title"/>
      </xsl:attribute>
      <div class="navHandle" id="{$id}_tggl">
        <xsl:if test="not($local_name='page') and (boolean(lsb:page) or
boolean(lsb:folder))">
          <xsl:attribute name="onclick">
            <xsl:text>top.oNAV._lsb_m_hideChildren(</xsl:text>
            <xsl:value-of select="$id"/>
            <xsl:text>)</xsl:text>
          </xsl:attribute>
        </xsl:if>
        <img id="{$id}_tggl_img" height="9" width="9">
          <xsl:attribute name="src">
            <xsl:choose>
              <xsl:when test="not($local_name='page') and (boolean(lsb:page)
or boolean(lsb:folder))">
                <xsl:text>images/minus.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">
        <xsl:attribute name="onclick">
          <xsl:text>top.oNAV._lsb_m_navigate(</xsl:text>
          <xsl:value-of select="$id"/>
          <xsl:text>)</xsl:text>
        </xsl:attribute>
        <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>
  <xsl:template match="lsb:label | text() | lsb:title | lsb:regions"/>
</xsl:stylesheet>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread