How to form the xsl file

This section can be used to submit suggestions for Extension Builder.
Note that this section is not monitored for support.
Forum rules
This forum section can be used to submit suggestions for Extension Builder.
Note that this section is not monitored for support.
Post Reply
User avatar
Patrik iden
 
 
Posts: 662
Joined: Wed Mar 24, 2010 9:07 pm
Location: Sweden

How to form the xsl file

Post by Patrik iden » Wed May 06, 2015 10:24 am

Hello i have this HTML menu and xsl code but the xsl code is not working. Any boudy know how to form the xsl code for this HTML menu?
Thank you.

Code: Select all

<!-- Nav -->
				<nav class="nav">
					<ul class="nav-list">
						<li class="nav-item">
							<a href="?=home">Home</a>
							<ul class="nav-submenu">
								<li class="nav-submenu-item">
									<a href="?=submenu-1">Submenu item 1</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-2">Submenu item 2</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-3">Submenu item 3</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-4">Submenu item 4</a>
								</li>
							</ul>
						</li>
						<li class="nav-item">
							<a href="?=about">About</a>
						</li>
						<li class="nav-item">
							<a href="?=services">Services</a>
							<ul class="nav-submenu">
								<li class="nav-submenu-item">
									<a href="?=submenu-1">Submenu item 1</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-2">Submenu item 2</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-3">Submenu item 3</a>
								</li>
								<li class="nav-submenu-item">
									<a href="?=submenu-4">Submenu item 4</a>
								</li>
							</ul>
						</li>
						<li class="nav-item">
							<a href="?=portfolio">Portfolio</a>
						</li>
						<li class="nav-item">
							<a href="?=testimonials">Testimonials</a>
						</li>
						<li class="nav-item">
							<a href="?=contact">Contact</a>
						</li>
					</ul>
				</nav>
				<!-- /Nav -->
This is the xsl i have now, but it does not work:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:call-template name="menu" />
</xsl:template>
<xsl:template name="menu">
<ul class="nav-list>
<xsl:apply-templates select="MENU/ITEM" />
</ul>
</xsl:template>
<xsl:template match="ITEM">
<li class="nav-item">
<a href="{URL}"><xsl:value-of select="NAME"/><xsl:value-of select="TITLE"/></a>
<xsl:if test="ITEM">
<ul class="nav-submenu">
<li class="nav-submenu-item">
<xsl:apply-templates select="ITEM"/>
</ul>
</xsl:if>
</li>
</li>
</xsl:template>
</xsl:stylesheet>

User avatar
Pablo
 
Posts: 20174
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: How to form the xsl file

Post by Pablo » Wed May 06, 2015 10:59 am

I'm sorry I cannot help you write xsl files, for me that would also take some time to try to see what works.
However your current version does not seems to be valid.

For example:

Code: Select all

<ul class="nav-submenu">
<li class="nav-submenu-item">
<xsl:apply-templates select="ITEM"/>
</ul>
is missing a closing </li>

User avatar
Patrik iden
 
 
Posts: 662
Joined: Wed Mar 24, 2010 9:07 pm
Location: Sweden

Re: How to form the xsl file

Post by Patrik iden » Wed May 06, 2015 3:50 pm

OK. Thank's anyway.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 2 guests