不如帖出来吧,把DTD和XML例子都帖一分出来。

解决方案 »

  1.   

    thanks 9p(在问题中成长):
    [email protected]
      

  2.   

    谢谢。
    [email protected]
      

  3.   

    能发给我一份吗?谢谢。
    [email protected]
      

  4.   

    Xtree.xml
    <?xml version='1.0'?>
    <?xml-stylesheet type="text/xsl" href="xtree.xsl" ?>
    <Level Name="Root" Opened="true" Loaded="true" Id="211">
    <Level Name="Sub1" Loaded="true" Opened="false" Id="2131">
    <Item URL="http://">Document0</Item>
    <Item URL="http://">Document01</Item>
    <Level URL="http://" Name="Sub11" Loaded="true" Opened="false" Id="2123">
    <Level URL="http://" Name="Sub111" Loaded="true" Opened="false" Id="11">
    <Item URL="http://">Document</Item>
    </Level>
    </Level>
    </Level>
    <Level Name="Sub2" Loaded="true" Opened="true" Id="44">
    <Level Name="Sub21" URL="http://" Loaded="true" Opened="false" Id="3423">
    <Item>Document2</Item>
    </Level>
    </Level>
    </Level>
    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"><!--
    //****************************************************************
    // You are free to copy the "XTree" scripts as long as you
    // keep this copyright notice:
    //
    // original script concepts realized by
    //     Author:  Emmanuele De Andreis ([email protected]) Dec '2000
    //     Located: http://www.duemetri.it/xtree
    //
    // *** SEE <WhatsNew.txt> FOR A LISTING OF MODIFICATIONS MADE ***
    //****************************************************************
    -->
      <xsl:template match="/">
        <HTML>
         <HEAD>
         <link rel="stylesheet" href="xtree.css" />
         <SCRIPT><![CDATA[
        //Ora assegnamo la giusta chiamata alla funzione
        //per caricare il nodo o visualizzarlo
        
         function SetNode(nodeName) {
         if (eval("Node" + nodeName + ".Loaded == 'true';")) {     if (eval("Items" + nodeName + ".style.display == 'none';")) {
         // Open
         eval("Image" + nodeName + ".src = 'images/minus.gif'");
         eval("NodeImage" + nodeName + ".src = 'images/open.gif'");
         eval("Items" + nodeName + ".style.display = 'block'");
         }
         else {
         // Close
         eval("Image" + nodeName + ".src = 'images/plus.gif'");
         eval("NodeImage" + nodeName + ".src = 'images/closed.gif'");
         eval("Items" + nodeName + ".style.display = 'none'");
         }
        }
    else {
    // Load
    alert('load');
    }
         }
            ]]>//</SCRIPT>
         </HEAD>
         <BODY>
             <xsl:apply-templates/>
             </BODY>
        </HTML>
      </xsl:template>
      
      
      <xsl:template match="Level">
          <DIV class="LevelHeader">
           <xsl:attribute name="Id">Node<xsl:value-of select="@Id"/></xsl:attribute>
           <xsl:attribute name="Name"><xsl:value-of select="@Name"/></xsl:attribute>
           <xsl:attribute name="Loaded"><xsl:value-of select="@Loaded"/></xsl:attribute>
          
    <!-- Mettiamo il simbolo +  o -
         Vediamo se il nodo e' aperto o chiuso -->
    <xsl:choose>
    <xsl:when test="@Opened[.='true']">
         <IMG SRC="images/minus.gif">
           <xsl:attribute name="Id">Image<xsl:value-of select="@Id"/></xsl:attribute>
    <xsl:attribute name="onClick">SetNode('<xsl:value-of select="@Id"/>');</xsl:attribute>
         </IMG>
         <IMG SRC="images/open.gif">
           <xsl:attribute name="Id">NodeImage<xsl:value-of select="@Id"/></xsl:attribute>
    <xsl:attribute name="onDblClick">SetNode('<xsl:value-of select="@Id"/>');</xsl:attribute>
         </IMG>
        </xsl:when>
         <xsl:otherwise>
    <IMG SRC="images/plus.gif">
           <xsl:attribute name="Id">Image<xsl:value-of select="@Id"/></xsl:attribute>
    <xsl:attribute name="onClick">SetNode('<xsl:value-of select="@Id"/>');</xsl:attribute>
    </IMG>
         <IMG SRC="images/closed.gif">
           <xsl:attribute name="Id">NodeImage<xsl:value-of select="@Id"/></xsl:attribute>
    <xsl:attribute name="onDblClick">SetNode('<xsl:value-of select="@Id"/>');</xsl:attribute>
         </IMG>
        </xsl:otherwise>
    </xsl:choose> <xsl:choose>
    <xsl:when test="@URL">
          <A><xsl:attribute name="HREF"><xsl:value-of select="@URL"/></xsl:attribute>
            <xsl:value-of select="@Name"/>
          </A>
          </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="@Name"/>
        </xsl:otherwise>
    </xsl:choose>
       
          </DIV>
          
          <DIV class="LevelItems">
           <xsl:attribute name="Id">Items<xsl:value-of select="@Id"/></xsl:attribute>
          
      <xsl:choose>
    <xsl:when test="@Opened[.='true']">
         <xsl:attribute name="Style">display: block; Margin-left: 16;</xsl:attribute>
        </xsl:when>
         <xsl:otherwise>
         <xsl:attribute name="Style">display: none; Margin-left: 16;</xsl:attribute>
        </xsl:otherwise>
    </xsl:choose>
           
           <xsl:apply-templates />
          </DIV>
       </xsl:template>
      <xsl:template match="Item">
         <DIV Class="Item">
          <IMG SRC="images/blank.gif" />
          <IMG SRC="images/document.gif" />
         
    <xsl:choose>
    <xsl:when test="@URL">
          <A><xsl:attribute name="HREF"><xsl:value-of select="@URL"/></xsl:attribute>
            <xsl:apply-templates />
          </A>
          </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates />
        </xsl:otherwise>
    </xsl:choose>
         
         </DIV>
      </xsl:template>
      
      <xsl:template match="text()">
       <xsl:value-of />
      </xsl:template></xsl:stylesheet>
      

  5.   

    还有个样式表
    .LevelHeader {font-size: 8pt}
    .LevelItems { font-size: 8pt; border-style: none}
    body {font-family: Tahoma}
      

  6.   

    ths  beloved() !!!!有例子大家就比较好办事了:))