maven-plugins/faq/plugin.jelly
jstrachan 529a9507f2 Upgraded to newer version fo Jelly to fix some issues in the FAQ and html2xdoc plugins where the XML declaration could appear twice
Also patched the faq plugin to use ${basedir} so that it works inside a reactor build


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113158 13f79535-47bb-0310-9956-ffa450edef68
2003-03-19 19:21:16 +00:00

89 lines
2.2 KiB
XML

<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:x="jelly:xml"
xmlns:html="jelly:html"
xmlns:maven="jelly:maven"
xmlns:log="jelly:log"
xmlns:util="jelly:util"
xmlns:doc="doc"
xmlns:m="maven">
<goal name="faq"
description="Generates an FAQ xdoc file from an FAQ XML document">
<j:set var="destfile" value="${maven.faq.dest.file}"/>
<j:if test="${empty(destfile)}">
<j:set var="destfile" value="${maven.build.dir}/generated-xdocs/faq.xml"/>
</j:if>
<mkdir dir="${maven.build.dir}/generated-xdocs"/>
<j:set var="srcfile" value="${maven.faq.src.file}"/>
<j:if test="${empty(srcfile)}">
<j:set var="srcfile" value="${basedir}/xdocs/faq.fml"/>
</j:if>
<util:file var="srcfileFile" name="${srcfile}"/>
<j:set var="srcfile" value="${srcfileFile.getCanonicalPath()}"/>
<util:file var="destfileFile" name="${destfile}"/>
<j:set var="destfile" value="${destfileFile.getCanonicalPath()}"/>
<j:set var="outputencoding" value="${maven.docs.outputencoding}"/>
<x:parse var="doc" xml="${srcfileFile}"/>
<x:set var="root" select="$doc/*"/>
<j:file name="${destfile}" encoding="${outputencoding}" outputMode="xml">
<document>
<properties>
<title><x:expr select="$root/title"/></title>
</properties>
<body>
<section name="Frequently Asked Questions">
<x:forEach select="$root/part">
<p>
<strong><x:expr select="title"/></strong>
</p>
<ol>
<x:forEach select="faq">
<li>
<x:element name="a">
<x:attribute name="href">#<x:expr select="@id"/></x:attribute>
<x:copyOf select="question/node()"/>
</x:element>
</li>
</x:forEach>
</ol>
</x:forEach>
</section>
<x:forEach select="$root/part">
<x:element name="section">
<x:attribute name="name"><x:expr select="title"/></x:attribute>
<x:forEach select="faq">
<dl>
<dt>
<x:element name="a">
<x:attribute name="name"><x:expr select="@id"/></x:attribute>
<x:copyOf select="question/node()"/>
</x:element>
</dt>
<dd>
<x:copyOf select="answer/node()"/>
</dd>
</dl>
</x:forEach>
</x:element>
</x:forEach>
</body>
</document>
</j:file>
</goal>
</project>