Files
maven-plugins/faq/src/plugin-resources/faq.jsl
T
ltheussl 955ef31fd0 PR: MPFAQ-20
Use the var parameter in the x:forEach jelly tag to make it work with upgraded dependencies for Maven-1.1-beta-3.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@425162 13f79535-47bb-0310-9956-ffa450edef68
2006-07-24 19:49:53 +00:00

105 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
* ========================================================================
*
* Copyright 2001-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.
*
* ========================================================================
-->
<!-- stylesheet to be used -->
<jsl:stylesheet select="$doc"
xmlns:j="jelly:core"
xmlns:jsl="jelly:jsl"
xmlns:x="jelly:xml"
xmlns:doc="doc"
xmlns="dummy"
trim="true">
<jsl:template match="faqs" trim="false">
<j:set var="title"><x:expr select="@title" /></j:set>
<j:set var="toplinks"><x:expr select="@toplink" /></j:set>
<document>
<properties>
<title>${title}</title>
</properties>
<body>
<section name="${title}">
<x:forEach select="part">
<p>
<strong><x:expr select="title"/></strong>
</p>
<ol>
<x:forEach var="entry" select="faq">
<li>
<j:set var="_id"><x:expr select="$entry/@id"/></j:set>
<j:set var="_id">#<doc:escapeNameToken value="${_id}"/></j:set>
<a href="${_id}">
<x:copyOf select="$entry/question/node()"/>
</a>
</li>
</x:forEach>
</ol>
</x:forEach>
</section>
<jsl:applyTemplates trim="true" />
</body>
</document>
</jsl:template>
<jsl:template match="part">
<j:set var="name"><x:expr select="title" /></j:set>
<section name="${name}">
<jsl:applyTemplates select="faq" trim="true" />
</section>
</jsl:template>
<jsl:template match="faq">
<dl>
<jsl:applyTemplates trim="true" />
</dl>
</jsl:template>
<jsl:template match="question">
<dt class="question">
<j:set var="_id"><x:expr select="../@id"/></j:set>
<j:set var="_id"><doc:escapeNameToken value="${_id}"/></j:set>
<a name="${_id}"/><jsl:applyTemplates trim="true" />
</dt>
</jsl:template>
<jsl:template match="answer">
<dd>
<jsl:applyTemplates trim="true" />
<j:if test="${toplinks != 'false'}">
<j:set var="top"><x:expr select="../../../@title"/></j:set>
<j:set var="_top">#<doc:escapeNameToken value="${top}"/></j:set>
<div class="xright"><a href="${_top}">[top]</a></div>
<br/>
</j:if>
</dd>
</jsl:template>
<!-- copy any other elements through -->
<jsl:template match="*" trim="false"><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>