Skip to content

Instantly share code, notes, and snippets.

@ech01
Created October 10, 2016 14:49
Show Gist options
  • Save ech01/eb25bc32f7d1989187c025abb5144f1f to your computer and use it in GitHub Desktop.
Save ech01/eb25bc32f7d1989187c025abb5144f1f to your computer and use it in GitHub Desktop.
Sitemap DDR
<?xml version="1.0" encoding="utf-8" ?>
<manifest>
<template>Sitemap.xslt</template>
<stylesheets>
<stylesheet>[MANIFEST]/sitemap.css</stylesheet>
</stylesheets>
<defaultTemplateArguments>
<templateArgument name="CSSClass" value="sitemap" />
</defaultTemplateArguments>
</manifest>
DIV.sitemap UL {
float: left;
margin: 0;
padding: 0 2em 0 0;
}
DIV.sitemap UL A {
font-weight: bold;
}
DIV.sitemap UL UL {
float: none;
margin: 0;
padding: 1em 0 0 0;
}
DIV.sitemap UL UL A {
font-weight: normal;
}
DIV.sitemap UL UL UL {
margin: 0;
padding: 0 0 0 1em;
}
DIV.sitemap LI {
list-style-type: none;
}
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:param name="CSSClass">row sitemap match-height</xsl:param>
<xsl:template match="/*">
<xsl:apply-templates select="root" />
</xsl:template>
<xsl:template match="root">
<div class="{$CSSClass}">
<xsl:apply-templates select="node" mode="topLevel" />
</div>
<div style="clear:both"></div>
</xsl:template>
<xsl:template match="node" mode="topLevel">
<div class="col-md-6 col-sm-6">
<ul>
<li>
<xsl:choose>
<xsl:when test="@enabled = 1">
<a href="{@url}">
<xsl:value-of select="@text" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@text" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="node">
<ul>
<xsl:apply-templates select="node" />
</ul>
</xsl:if>
</li>
</ul>
</div>
</xsl:template>
<xsl:template match="node">
<li>
<xsl:choose>
<xsl:when test="@enabled = 1">
<a href="{@url}">
<xsl:value-of select="@text" />
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@text" />
</xsl:otherwise>
</xsl:choose>
<xsl:if test="node">
<ul>
<xsl:apply-templates select="node" />
</ul>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>
@ech01
Copy link
Author

ech01 commented Mar 9, 2018

This is from Risdall.com, purveyors of fine websites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment