Files
maven-plugins/xdoc/src/plugin-resources/sitemap.jsl
T
2005-12-06 19:05:28 +00:00

151 lines
5.4 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<jsl:stylesheet
select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:x="jelly:xml"
xmlns:fmt="jelly:fmt"
xmlns:util="jelly:util"
xmlns:doc="doc"
xmlns="dummy" trim="false">
<jsl:template match="project">
<document>
<properties>
<title key="sitemap.title"
bundle="plugin-resources.templates.templates" >
<message key="sitemap.title"
bundle="plugin-resources.templates.templates" />
</title>
</properties>
<body>
<j:set var="name"><x:expr select="@name"/></j:set>
<section key="sitemap.section.title"
bundle="plugin-resources.templates.templates"
name="Sitemap">
<jsl:applyTemplates select="body/menu"/>
<jsl:applyTemplates select="$projectNav/body/menu"/>
</section>
</body>
</document>
</jsl:template>
<jsl:template match="menu" trim="true">
<x:set var="currentMenu" select="." />
<div id="navcolumn">
<x:if select="$currentMenu/@name and not($currentMenu/@key)">
<h5><x:expr select="string(@name)"/></h5>
</x:if>
<x:if select="$currentMenu/@key">
<j:set var="_key"><x:expr select="@key"/></j:set>
<j:set var="_bundle"><x:expr select="@bundle"/></j:set>
<h5>
<j:if test="${!empty(_bundle)}">
<message key="${_key}" bundle="${_bundle}"/>
</j:if>
<j:if test="${empty(_bundle)}">
<message key="${_key}"/>
</j:if>
</h5>
</x:if>
<ul><jsl:applyTemplates select="item"/></ul>
</div>
</jsl:template>
<jsl:template match="item">
<x:set var="currentItem" select="." />
<j:set var="description" value=""/>
<j:set var="link"><x:expr select="@href"/></j:set>
<j:if test="${link.startsWith('/')}" trim="yes">
<j:set var="link" value="${link.substring(1)}"/>
</j:if>
<j:set var="xml_link" value="${stringUtils.replace(link, '.html', '.xml')}"/>
<util:available file="${maven.docs.src}/${xml_link}">
<util:file var="xmlfile" name="${maven.docs.src}/${xml_link}"/>
<x:parse var="inputdoc" xml="${xmlfile}"/>
<x:if select="$inputdoc//meta[@name = 'description']/@content">
<j:set var="description">
[<x:expr select="string($inputdoc//meta[@name = 'description']/@content)"/>]
</j:set>
</x:if>
</util:available>
<j:set var="collapse"><x:expr select="@collapse"/></j:set>
<j:choose>
<j:when test="${collapse != 'true'}">
<li class="none">
<x:if select="$currentItem/@name and not($currentItem/@key)">
<a href="${link}"><x:expr select="@name"/></a> ${description}
</x:if>
<x:if select="$currentItem/@key">
<j:set var="_key"><x:expr select="@key"/></j:set>
<j:set var="_bundle"><x:expr select="@bundle"/></j:set>
<a href="${link}">
<j:if test="${!empty(_bundle)}">
<message key="${_key}" bundle="${_bundle}"/>
</j:if>
<j:if test="${empty(_bundle)}">
<message key="${_key}" />
</j:if>
</a> ${description}
</x:if>
</li>
</j:when>
<j:otherwise>
<li class="expanded">
<x:if select="$currentItem/@name and not($currentItem/@key)">
<a href="${link}"><x:expr select="@name"/></a> ${description}
</x:if>
<x:if select="$currentItem/@key">
<j:set var="_key"><x:expr select="@key"/></j:set>
<j:set var="_bundle"><x:expr select="@bundle"/></j:set>
<a href="${link}">
<j:if test="${!empty(_bundle)}">
<message key="${_key}" bundle="${_bundle}"/>
</j:if>
<j:if test="${empty(_bundle)}">
<message key="${_key}" />
</j:if>
</a> ${description}
</x:if>
<ul>
<jsl:applyTemplates select="item"/>
</ul>
</li>
</j:otherwise>
</j:choose>
</jsl:template>
<jsl:template match="*">
<jsl:copy trim="true">
<jsl:applyTemplates trim="true"/>
</jsl:copy>
</jsl:template>
<!-- element values don't pass through as text -->
<jsl:template match="@*"/>
<!-- CDATA and text nodes pass-thru -->
<jsl:template match="text()">
<x:expr select="."/>
</jsl:template>
</jsl:stylesheet>