xsl-list
[Top] [All Lists]

Re: Display children of node with given id!!

2005-02-15 04:18:49

something like this perhaps?

<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  
  <xsl:param name="css"/>
  <xsl:param name="url"/>
  <xsl:param name="id"/> 
  <xsl:output method="html" indent="yes"/>

  <xsl:template match="/">
    <table cellspacing="0" cellpadding="2" class="{$css}">
      <tr>
          <td class="ui_tree_bar">
          <a href="{$url}&amp;action=add">add</a>
        </td>
        </tr>
      <xsl:apply-templates select="//tree_node[(_at_)id=$id]"/>
    </table>
  </xsl:template>
  
  <xsl:template match="tree_node">
      
        <tr>
        <td>
          <table width="100%">
              <tr>
                <td align="right" width="{count(ancestor-or-self::*) * 10}">
                <a href="{$url}&amp;node={(_at_)id}">+</a>
              </td>
                <td>
                  <xsl:value-of select="@value"/>
                </td>
                  <td width="25%">
                    <a 
href="{$url}&amp;action=edit&amp;node={(_at_)id}">edit</a>
                    <a
href="{$url}&amp;action=delete&amp;node={(_at_)id}">delete</a>
                  </td>
            </tr>
            </table>
          </td>
      </tr> 
        <xsl:apply-templates/> 
          
  </xsl:template>

</xsl:stylesheet>



saxon -o tree2.html tree2.xml tree2.xsl id=7






<table cellspacing="0" cellpadding="2" class="">
   <tr>
      <td class="ui_tree_bar"><a href="&amp;action=add">add</a></td>
   </tr>
   <tr>
      <td>
         <table width="100%">
            <tr>
               <td align="right" width="20"><a href="&amp;node=7">+</a></td>
               <td>Test</td>
               <td width="25%"><a href="&amp;action=edit&amp;node=7">edit</a><a 
href="&amp;action=delete&amp;node=7">delete</a></td>
            </tr>
         </table>
      </td>
   </tr>
   
   <tr>
      <td>
         <table width="100%">
            <tr>
               <td align="right" width="30"><a href="&amp;node=8">+</a></td>
               <td>Test Sub</td>
               <td width="25%"><a href="&amp;action=edit&amp;node=8">edit</a><a 
href="&amp;action=delete&amp;node=8">delete</a></td>
            </tr>
         </table>
      </td>
   </tr>
   
   <tr>
      <td>
         <table width="100%">
            <tr>
               <td align="right" width="30"><a href="&amp;node=9">+</a></td>
               <td>Test Sub One</td>
               <td width="25%"><a href="&amp;action=edit&amp;node=9">edit</a><a 
href="&amp;action=delete&amp;node=9">delete</a></td>
            </tr>
         </table>
      </td>
   </tr>
   
   <tr>
      <td>
         <table width="100%">
            <tr>
               <td align="right" width="40"><a href="&amp;node=10">+</a></td>
               <td>Test Sub Two</td>
               <td width="25%"><a 
href="&amp;action=edit&amp;node=10">edit</a><a 
href="&amp;action=delete&amp;node=10">delete</a></td>
            </tr>
         </table>
      </td>
   </tr>
   
   
</table>

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>