Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a goto command, or something alike in XSL

Status
Not open for further replies.

Henk1

Programmer
Oct 26, 2001
46
ZA
Hi,

I would like to create a menu structure, based on a directory structure on a server. Obviously I would like to have unlimited depth of this structure.

My problem is that except for hardcoding a million sub-loops within the parent loops, I don't know how to get out of the loop and let it start from the top, using variables, in stead of hard coding.

I attach my xsl code for further information. I have only been doning this for a day, so if you have any comments on my code, please let me know as well.

Thank you.
 
Sorry, here is the code. I have made a comment where the goto must go in.

Another question.
Is this the correct way of changing the value of a variable?

Third question:
Is there a way of have something like this:
If variable (greater than)/(less than) value



<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?>
<stylesheet version=&quot;1.0&quot; xmlns=&quot; <xsl:template match=&quot;/&quot;>
<html>
<title>
Menu Structure
</title>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match=&quot;Menu&quot;>
<xsl:variable name=&quot;level&quot; select=&quot;0&quot;/>
<xsl:variable name=&quot;menulevel&quot; select=&quot;'MenuLevel'+<xsl:value-of select='$level'/>&quot;/>

<xsl:for-each select=&quot;<xsl:value-of select='$menulevel'&quot;>
<xsl:choose>
<xsl:when test=&quot;href=''&quot;>
<xsl:variable name=&quot;level&quot; select=&quot;<xsl:value-of select='$level'/>+1&quot;/>
<xsl:template match=&quot;$menulevel&quot;>
<!--The goto must go in here -->
</xsl:template>
</xsl:when>
<xsl:eek:therwise>
</xsl:eek:therwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</stylesheet>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top