Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2006
    Posts
    131
    Thanks
    5
    Thanked 0 Times in 0 Posts

    itereate REF name

    hello...

    I'm trying to iterate through the ref name. So it would be "tree1, tree2, tree3" etc.

    Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    	<xsl:template match="/system-index-block">
    		<ul class="treeview" id="treemenu1">
    			<xsl:apply-templates select="system-page | system-folder | system-symlink">
    				<xsl:sort select="order"/>
    			</xsl:apply-templates>
    		</ul>
    	</xsl:template>
    	
    	<xsl:template match="system-folder">
    		<li>
    			<a>
    				<xsl:attribute name="href">
    					<xsl:attribute name="ref">$tree</xsl:attribute>
    					$tree++
    					<xsl:choose>
    						<xsl:when test="system-page[name = 'index']">
    							<xsl:value-of select="system-page[name = 'index']/path"/>
    						</xsl:when>
    						<xsl:otherwise>
    							<xsl:value-of select="system-page[1]/path"/>
    						</xsl:otherwise>
    					</xsl:choose>
    				</xsl:attribute>
    				<xsl:apply-templates mode="getname" select="."/>
    			</a>
    
    
    
    		</li>
    	</xsl:template>
    	
    	<xsl:template match="system-page | system-symlink">
    		<li>
    			<a>
    				<xsl:attribute name="href">
    					<xsl:value-of select="path"/>
    				</xsl:attribute>
    				<xsl:apply-templates mode="getname" select="."/>
    			</a>
    		</li>
    	</xsl:template>
    	
    	<xsl:template match="system-folder | system-page | system-symlink" mode="getname">
    		<xsl:choose>
    			<xsl:when test="display-name">
    				<xsl:value-of select="display-name"/>
    			</xsl:when>
    			<xsl:when test="title">
    				<xsl:value-of select="title"/>
    			</xsl:when>
    			<xsl:otherwise>
    				<xsl:value-of select="name"/>
    			</xsl:otherwise>
    		</xsl:choose>
    	</xsl:template>
    	
    </xsl:stylesheet>
    ---------
    Client / Server Side Programmer II

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    from where did you get $tree and what is $tree++ ?

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •