Developer forum

Forum » Templates » Navigation xslt parent page

Navigation xslt parent page

Heine Virenfeldt Kristensen
Reply
New to DW xslt, have a question about the navigation.

Wants to make af <dl> menu, like this

<dl>
<dt>Level 1</dt>
<dd>Level 2.1</dd>
<dd>Level 2.2</dd>
</dl>

So that dt is the start node, and the dd is the sub nodes.

In the template, using this to make the menu - <ul id="footnav1" class="dwnavigation" settings="startlevel:1;endlevel:1;expandmode:all;template:ag-topEcom-dd.xslt;parentid:4;"></ul>, where parentid:4 is the <dt>

My xslt looks like this:

<?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" omit-xml-declaration="yes" indent="yes" encoding="utf-8" />
 
  <xsl:template match="/">
   <xsl:apply-templates select="NavigationTree[Page]" />
  </xsl:template>
 
  <xsl:template match="NavigationTree">
   <dl>
 <dt><xsl:value-of select="ancestor-or-self::Page[@AbsoluteLevel = '1']/@MenuText" /></dt>
    <xsl:apply-templates select="Page" />
   </dl>
  </xsl:template>
 
  <xsl:template match="Page">
   <dd>
    <a href="{@Href}">
     <xsl:value-of select="@MenuText" />
    </a>
    <xsl:if test="Page">
     <ul>
      <xsl:apply-templates select="Page" />
     </ul>
    </xsl:if>
   </dd>
  </xsl:template>
 </xsl:stylesheet>

And i get the <dd> but not the <dt>

Any one knows what I'm doing wrong?

/Heine

Replies

 
Nicolai Høeg Pedersen
Reply
In the /Files/Templates/Navigation folder of your solution you can find a LIClean.xslt file that creates a ul/li navigation. Use that and change ul to dl and li to dt... That should work.
 
Heine Virenfeldt Kristensen
Reply
That doesn't do the trick, it don't render the start page, just the subpages.

Sitestructur:

Visit us (start page, i use this as parrentid)
-- Open
-- Address

I want "Visit us" to be the <dt> and "Open" and "Address" to be <dd>

<dd> I get, but can't render "Visit us" as a <dt>?

 
Nicolai Høeg Pedersen
Reply
Hi Heine

yes you can. But then do not use Visit us as parentid... using parentid means that you select the pages below that ID.

Have a look at the navigation section in designs and layouts documentation:
http://developer.dynamicweb-cms.com/Files/Filer/Documentation/Design/(en-US)%20Designs%20and%20Layouts.pdf

 

You must be logged in to post in the forum