bob mcwhirter wrote:
Seems like site.jelly is causing the pains wrt <j:if>.Probably I should have sended you also my 'newer' site.jelly. This is still work in progress.
Who's familiar with it?
-bob
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
Markus
<?xml version="1.0"?>
<j:jelly trim="false" xmlns:j="jelly:core"
xmlns:x="jelly:xml"
xmlns:jsl="jelly:jsl"
xmlns:werkz="jelly:werkz"
xmlns:define="jelly:define"
xmlns:my="myMacros">
<!-- Use goals instead of macros -->
<define:taglib uri="myMacros">
<j:define tag="printRow">
<!--
count
-->
<j:choose>
<j:when test="${count % 2 > 0}">
<tr class="a"/>
</j:when>
<j:otherwise>
<tr class="b"/>
</j:otherwise>
</j:choose>
<!--
Need to be removed, somehow
</tr>
-->
</j:define>
<j:define tag="loadNavigation">
<!--
## Sets the navigation file
## filename
-->
<j:set var="nav" value="$node.selectSingleNode("document("$filename")/project")"/>
</j:define>
<j:define tag="selectNavigation">
<!--
## Selects the appropriate navigation file to use for the navbar. The
## current search priority is:
##
## - navigation.xml in current directory
## - navigation.xml in xdocs directory
## - project.xml in xdocs directory (deprecated)
## - project.xml in xdocs/stylesheets
##
#macro (selectNavigation $fileUtil $docSrc)
-->
<j:choose>
<j:when test="$fileUtil.file("$docSrc/$currentDir/navigation.xml").exists()">
<loadNavigation fileName="$docSrc/$currentDir/navigation.xml"/>
</j:when>
<j:when test="$fileUtil.file("$docSrc/navigation.xml").exists()">
<loadNavigation fileName="$docSrc/navigation.xml"/>
</j:when>
<j:when test="$fileUtil.file("$docSrc/project.xml").exists()">
<loadNavigation fileName="$docSrc/project.xml"/>
</j:when>
<j:when test="$fileUtil.file("$docSrc/stylesheets/project.xml").exists()">
<loadNavigation fileName="$docSrc/stylesheets/project.xml"/>
</j:when>
</j:choose>
</j:define>
<j:define tag="itemLink">
<!--
#macro( itemLink $item )
#if( $item.attrib("href").startsWith("http") ||
$item.attrib("href").startsWith("/site") )
<a href="$item.attrib("href")">$item.attrib("name")</a>
#else
<a href="$relativePath$item.attrib("href")">$item.attrib("name")</a>
#end
#end
-->
<j:choose>
<j:when test="$item.attrib("href").startsWith("http") ||
$item.attrib("href").startsWith("/site")">
<a href="$item.attrib("href")">$item.attrib("name")</a>
</j:when>
<j:otherwise>
<a href="$relativePath$item.attrib("href")">$item.attrib("name")</a>
</j:otherwise>
</j:define>
</define:taglib>
<!--
#######################################################################
## D V S L M A T C H I N G S T A R T S H E R E ##
#######################################################################
Not anymore I guess...
-->
<jsl:template match="document" name="document" trim=false>
<!--
This will probably a problem in the live template, we should therefor use
HTMLWriter
<!DOCTYPE html PUBLIC "-//CollabNet//DTD XHTML 1.0 Transitional//EN"
"http://www.collabnet.com/dtds/collabnet_transitional_10.dtd">
-->
<!-- Setup the relativePath using the toolbox. -->
<j:set var="infilename">$context.getAppValue("infilename")</j:set>
<j:set
var="currentDir">$context.toolbox.pathtool.getDirectoryComponent($infilename)</j:set>
<j:set
var="relativePath">$context.toolbox.pathtool.getRelativePath($infilename)</j:set>
<!--
Grab a reference to the project descriptor here so we can pull
info from it such as the cvs web url, etc ...
-->
<j:set var="$mavenProject">$context.getAppValue("mavenProject")</j:set>
<j:set var="$pomDocument">$mavenProject.createDocument()</j:set>
<j:set var="$pom">$pomDocument.selectSingleNode("/project")</j:set>
<!-- Selects the correct navigation file to use for this document. -->
<my:selectNavigation fileUtil="$context.toolbox.fileutil"
docSrc="$context.toolbox.docSrc"/>
<html>
<head>
<j:choose>
<j:when test="$!nav.title">
<title>$!nav.title - $node.properties.title</title>
</j:when>
<j:otherwise>
<title>$mavenProject.name - $node.properties.title</title>
</j:otherwise>
</j:choose>
<style type="text/css">
@import url("$relativePath/style/tigris.css");
@import url("$relativePath/style/maven.css");
</style>
<script type="text/javascript">
if (document.layers) {
document.writeln("<link rel="stylesheet" type="text/css"
href="$relativePath/style/ns4_only.css" media="screen" /><link rel="stylesheet"
type="text/css" href="$relativePath/style/maven_ns4_only.css" media="screen" />")
}
</script>
<link rel="stylesheet" type="text/css" href="$relativePath/style/print.css"
media="print" />
<j:foreach var="n" items="$node.properties.selectNodes("author")">
<meta name="author" value="$n"/>
<meta name="email" value="$n.attribute("email")" />
</j:foreach>
</head>
<body class="composite" marginwidth="0" marginheight="0">
<div id="banner">
<table border="0" cellspacing="0" cellpadding="8" width="100%">
<tr>
<td>
<!--
## I'm not sure exactly why this check is necessary as
## the organization logo should be null if not set in the POM. jvz.
-->
<j:if test="$mavenProject.organization.logo != ''">
<j:set var="alt" value="$mavenProject.organization.name"/>
<j:set var="src" value="$mavenProject.organization.logo"/>
<j:choose>
<j:when test="$mavenProject.organization.url">
<j:set var="home" value="$mavenProject.organization.url"/>
</j:when>
<j:otherwise>
<!--
## Fall back to the project url
-->
<j:set var="home" value="$mavenProject.url"/>
</j:otherwise>
</j:choose>
<a href="$home">
<j:choose>
<j:when test="$src.toString().startsWith("http")">
<img src="$src" align="left" alt="$alt" border="0" />
</j:when>
<j:otherwise>
<img src="$relativePath$src" align="left" alt="$alt" border="0" />
</j:otherwise>
</j:choose>
</a>
</j:if>
</td>
<td>
<div align="right" id="login">
<!--
## This really should be null
-->
<j:if test="$mavenProject.logo != ''">
<j:set var="alt" value="$mavenProject.name"/>
<j:set var="home" value="$mavenProject.url"/>
<j:set var="src" value="$mavenProject.logo"/>
<a href="$home">
<j:choose>
<j:when test="$src.toString().startsWith("http")">
<img src="$src" align="right" alt="$alt" border="0"/>
</j:when>
<j:otherwise>
<img src="$relativePath$src" align="right" alt="$alt"
border="0"/>
</j:otherwise>
</j:choose>
</a>
</j:if>
</div>
</td>
</tr>
</table>
</div>
<div id="breadcrumbs">
<table border="0" cellspacing="0" cellpadding="4" width="100%">
<tr>
<j:if test="$context.toolbox.date == 'left'">
<td>
Last published: $context.toolbox.buildDate
<j:if test="$context.toolbox.docVersion.indexOf("maven.xdoc.version") <
0">
| Doc for $context.toolbox.docVersion
</j:if>
</td>
</j:if>
<td>
<j:choose>
<j:when test="$nav.get("body/links/*")">
$context.applyTemplates( $nav, "body/links" )
</j:when>
<j:otherwise>
</j:otherwise>
</j:choose>
</td>
</tr>
</table>
</div>
<table border="0" cellspacing="0" cellpadding="8" width="100%" id="main">
<tr valign="top">
<td id="leftcol" width="20%">
<div id="navcolumn">
<j:if test="$context.toolbox.date == 'navigation-top'">
<div>
<small>Last published: $context.toolbox.buildDate</small>
</div>
</j:if>
<j:if test="$nav">
$context.applyTemplates( $nav, "body/menu" )
</j:if>
<!--
## Standard Maven Navigation
-->
<div><strong>Project Documentation</strong>
<div><small><a href="$relativePath/index.html">Front
Page</a></small></div>
<div>
<small><a href="$relativePath/project-info.html">Project
Info</a></small>
<j:set var="projectInfoFiles" value="["dependencies", "mail-lists",
"project-info", "team-list"]"/>
<f:foreach item="$infoFile" item="$projectInfoFiles">
<j:if test="$currentDir == '.' && $infilename ==
'${infoFile}.xml'">
<div><small><a href="$relativePath/mail-lists.html">Mailing
Lists</a></small></div>
<div><small><a href="$relativePath/team-list.html">Project
Team</a></small></div>
<div><small><a
href="$relativePath/dependencies.html">Dependencies</a></small></div>
<j:if test="$mavenProject.repository.url">
<div><small><a
href="$mavenProject.repository.url.toString().trim()">Source
Repository</a></small></div>
</j:if>
<j:if test="$mavenProject.issueTrackingUrl">
<div><small><a
href="$mavenProject.issueTrackingUrl.toString().trim()">Issue
Tracking</a></small></div>
</j:if>
</j:if>
</j:foreach>
</div>
<div>
<small><a href="$relativePath/maven-reports.html">Project
Reports</a></small>
<j:set var="projectReportFiles" value="["activity-log", "changelog",
"checkstyle-report", "file-activity-report", "javadoc", "jdepend-report",
"junit-report", "maven-reports", "task-list", "tasks", "changes", "cactus-report"]"/>
<f:foreach item="$reportFile" items="$projectReportFiles">
<j:if test="$currentDir == '.' && $infilename ==
'${reportFile}.xml'">
<j:if
test="$context.toolbox.fileutil.file("$context.toolbox.docSrc/tasks.xml").exists()">
<div><small><a
href="$relativePath/tasks.html">Tasks</a></small></div>
</j:if>
<j:if
test="$context.toolbox.fileutil.file("$context.toolbox.genDoc/task-list.xml").exists()">
<div><small><a href="$relativePath/task-list.html">Task
List</a></small></div>
</j:if>
<j:if
test="$context.toolbox.fileutil.file("$context.toolbox.docSrc/changes.xml").exists()">
<div><small><a
href="$relativePath/changes.html">Changes</a></small></div>
</j:if>
<j:if test="$mavenProject.repository">
<div><small><a href="$relativePath/changelog.html">Change
Log</a></small></div>
<div><small><a href="$relativePath/activity-log.html">Developer
Activity</a></small></div>
<div><small><a
href="$relativePath/file-activity-report.html">File Activity</a></small></div>
</j:if>
<j:if test="$context.toolbox.testSrcPresent == 'true'">
<div><small><a href="$relativePath/junit-report.html">Unit
Tests</a></small></div>
</j:if>
<j:if test="$context.toolbox.srcPresent == 'true'">
<div><small><a href="$relativePath/jdepend-report.html">Metric
Results</a></small></div>
<div><small><a
href="$relativePath/checkstyle-report.html">Checkstyle Report</a></small></div>
<div><small><a href="$relativePath/javadoc.html">Javadoc
Report</a></small></div>
</j:if>
<j:if
test="$context.toolbox.fileutil.file("$context.toolbox.docDest/clover").exists()">
<div><small><a href="$relativePath/clover/index.html">Clover
Test Coverage</a></small></div>
</j:if>
<j:if
test="$context.toolbox.fileutil.file("$context.toolbox.genDoc/cactus-report.xml").exists()">
<div><small><a href="$relativePath/cactus-report.html">Cactus
Tests</a></small></div>
</j:if>
</j:if>
</j:foreach>
</div>
<j:if test="$context.toolbox.srcPresent == 'true'">
<div><small><a
href="$relativePath/apidocs/index.html">JavaDocs</a></small></div>
<div><small><a href="$relativePath/xref/index.html">Source
XReference</a></small></div>
</j:if>
<j:choose>
<j:when
test="$context.toolbox.fileutil.file("$context.toolbox.docSrc/development-process.xml").exists()">
<div><small><a
href="$relativePath/development-process.html">Development Process</a></small></div>
</j:when>
<j:otherwise>
<div><small><a href="$context.toolbox.devProcess">Development
Process</a></small></div>
</j:otherwise>
</j:choose>
</div>
<j:if test="$context.toolbox.date == 'navigation-bottom'">
<div>
<small>Last published: $context.toolbox.buildDate</small>
</div>
</j:if>
</div>
</td>
<td>
<div id="bodycol">
<!--
## Insert MAIN body here
-->
<div class="app">
$context.applyTemplates("body/section")
$context.applyTemplates("body/glossary")
$context.applyTemplates("body/release")
$context.applyTemplates("body/changelog")
$context.applyTemplates("body/taskList")
</div>
</div>
</td>
</tr>
</table>
<div id="footer">
<table border="0" cellspacing="0" cellpadding="4">
<tr>
<td>
<j:choose>
<j:when test="$mavenProject.organization.name">
<j:choose>
<j:when test="$mavenProject.inceptionYear">
<j:choose>
<j:when>
$mavenProject.inceptionYear.toString() ==
$context.toolbox.currentYear )
© ${context.toolbox.currentYear}, $mavenProject.organization.name
</j:when>
<j:otherwise>
© ${mavenProject.inceptionYear}-${context.toolbox.currentYear},
$mavenProject.organization.name
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
© ${context.toolbox.currentYear}, $mavenProject.organization.name
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
© 1999-2002, Apache Software Foundation
</j:otherwise>
</j:choose>
<j:if test="$context.toolbox.date == 'bottom'">
- Last published: $context.toolbox.buildDate
</j:if>
</td>
<j:if test="$context.toolbox.date == 'bottom-right'>
<td align="right">Last published: $context.toolbox.buildDate</td>
</j:if>
</tr>
</table>
</div>
</body>
</html>
</jsl:template>
#*
* Process a menu for the navigation bar
*#
<jsl:template match="menu" name="menu">
<div>
<strong>$attrib.name</strong>
$context.applyTemplates( "item" )
</div>
</jsl:template>
<jsl:template match="item" name="item">
<div>
<small> #itemLink( $node ) </small>
$context.applyTemplates( "item" )
</div>
</jsl:template>
#*
* Process the breadcrumb navbar
*#
<jsl:template match="links" name="links">
<div align="right">
<j:if test="$context.toolbox.date == 'right'">
Last published: $context.toolbox.buildDate
<j:if test="$nav.get("body/links/*")">
|
</j:if>
</j:if>
<j:foreach item="$item" items="$node.selectNodes("item")">
<j:if test="$velocityCount != 1"> | </j:if>
<my:itemLink item="$item"/>
</j:foreach>
</div>
</jsl:template>
#*
* process a documentation section
*#
<jsl:template match="section" name="section">
<div class="h3">
<j:if test="$attrib.name.length() > 0">
<h3><a name="$attrib.name">$attrib.name</a></h3>
</j:if>
$context.applyTemplates("*")
</div>
</jsl:template>
<jsl:template match="subsection" name="subsection">
<div class="h4">
<j:if test="$attrib.name.length() > 0">
<h4><a name="$attrib.name">$attrib.name</a></h4>
</j:if>
$context.applyTemplates("*")
</div>
</jsl:template>
<jsl:template match="source" name="source">
<div id="source">
<pre>$toolbox.htmlescape.getText( $node.value() )</pre>
</div>
<!--
## <div id="helptext">
## <table border="0" cellspacing="0" cellpadding="3" width="100%">
## <tr>
## <td>
## <p/>
## <pre>$toolbox.htmlescape.getText( $node.value() )</pre>
## </td>
## </tr>
## </table>
## </div>
-->
</jsl:template>
<jsl:template match="table" name="table">
<j:set var="rowcount" value="0"/>
<table cellpadding="3" cellspacing="2" border="1" width="100%">
$context.applyTemplates("*")
</table>
</jsl:template>
<jsl:template match="tr" name="tr">
<my:printRow count=$rowcount"/>
<j:set var="rowcount" value="$rowcount + 1"/>
$context.applyTemplates("*")
</tr>
</jsl:template>
<jsl:template match="td" name="td">
<j:if test="$attrib.colspan">
<j:set var="colspan" value="$attrib.colspan"/>
colspan="$!colspan"
</j:if>
<j:if test="$attrib.rowspan">
<j:set var="rowspan" value="$attrib.rowspan"/>
</j:if>
<td colspan="$!colspan" rowspan="$!rowspan">
<j:foreach item="n" items="$node.children()">
$context.applyTemplates($n)
</j:foreach>
</td>
</jsl:template>
<jsl:template match="th" name="th">
<j:if test="$attrib.colspan">
<j:set var="colspan" value="$attrib.colspan"/>
colspan="$!colspan"
</j:if>
<j:if test="$attrib.rowspan">
<j:set var="rowspan" value="$attrib.rowspan"/>
</j:if>
<th colspan="$!colspan" rowspan="$!rowspan">
<j:foreach item="n" items="$node.children()">
$context.applyTemplates($n)
</j:foreach>
</th>
</jsl:template>
<!--
## -----------------------------------------------------
## G L O S S A R Y
## -----------------------------------------------------
-->
<jsl:template match="glossary" name="glossary">
$context.applyTemplates("glossary-entries/glossary-entry")
</jsl:template>
<!--
<jsl:template match="glossary-entry" name="glossary-entry">
<strong>$context.node.name</strong>
<br/>
$context.node.definition
<p/>
</jsl:template>
-->
<!--
## -----------------------------------------------------
## C H A N G E L O G
## -----------------------------------------------------
-->
<jsl:template match="changelog" name="changelog">
<j:set var="$rowcount" value="0")
<table width="100%">
<tr>
<th>Date</th><th>Author</th><th>Files/Message</th>
</tr>
$context.applyTemplates("changelog-entry")
</table>
</jsl:template>
<jsl:template match="changelog-entry" name="changelog-entry">
<printRow count="$rowcount"/>
<td>$node.date.value() $node.time.value()</td>
<td>$context.toolbox.htmlescape.getText($node.author.value())</td>
<td>$context.applyTemplates("file")
<pre>$context.toolbox.htmlescape.getText($node.msg.value())</pre>
</td>
</tr>
<j:set var="rowcount" value="$rowcount + 1"/>
</jsl:template>
<jsl:template match="file" name="file">
<a href="$mavenProject.repository.url.toString().trim()$node.name.value()">
$node.name.value()</a> -
<a
href="$mavenProject.repository.url.toString().trim()$node.name.value()?rev=$node.revision.value()&content-type=text/vnd.viewcvs-markup">
v$node.revision.value()</a> <br/>
</jsl:template>
<!--
## -----------------------------------------------------
## T A S K L I S T
## -----------------------------------------------------
-->
<jsl:template match="taskList" name="taskList">
<j:set var="$rowcount" value="0")
<table width="100%">
<tr>
<th>Filename / Tasks</th>
</tr>
$context.applyTemplates("taskEntry")
</table>
</jsl:template>
<jsl:template match="taskEntry" name="taskEntry">
<printRow count="$rowcount"/>
<td>
$node.filename.value()
$context.applyTemplates("tasks/task")
</td>
</tr>
<j:set var="rowcount" value="$rowcount + 1"/>
</jsl:template>
<jsl:template match="task" name="task">
<ul>
<li> $node.description.value() </li>
</ul>
</jsl:template>
<!--
## -----------------------------------------------------
## C H A N G E S L I S T
## -----------------------------------------------------
-->
<jsl:template match="release" name="release">
<j:set var="rowcount" value="0"/>
<div class="h3">
<h3><a name="$attrib.version">$attrib.version - $attrib.date</a></h3>
<table width="100%">
<tr><th>Type</th><th>Changes</th><th>By</th></tr>
$context.applyTemplates("*")
</table>
</div>
</jsl:template>
<jsl:template match="action" name="action">
<my:printRow count="$rowcount"/>
<td>
<j:choose>
<j:when test="$attrib.type.equals("add")">
<img src="images/add.gif" alt="add" border="0"/>
</j:when>
<j:when test="$attrib.type.equals("fix")">
<img src="images/fix.gif" alt="fix" border="0"/>
</j:when>
<j:when test="$attrib.type.equals("update")">
<img src="images/update.gif" alt="update" border="0"/>
</j:when>
<j:when test="$attrib.type.equals("remove")">
<img src="images/remove.gif" alt="remove" border="0"/>
</j:when>
</td>
<td>
<j:foreach item="n" items="node.children()">
$context.applyTemplates($n)
</j:foreach>
<j:if test="$attrib.due-to != ''">
<p>Due to
<j:choose>
<j:when test="$attrib.due-to-email != ''">
<a href="mailto:$attrib.due-to-email">$attrib.due-to</a>
</j:when>
<j:otherwise>
$attrib.due-to
</j:otherwise>
</j:choose>
</p>
</j:if>
</td>
<td>
<a href="team-list.html#$attrib.dev">$attrib.dev</a>
</td>
</tr>
<j:set var="rowcount" value="$rowcount + 1")
</jsl:template>
<!--
## -----------------------------------------------------
## D E F A U L T C O P Y
## -----------------------------------------------------
-->
<jsl:template match="text()" name="text()">
$node.value()
</jsl:template>
<jsl:template match="@*" name="@*">
$node.name()="$node.value()"
</jsl:template>
<jsl:template match="*" name="*">
<j:choose>
<j:when test="$node.name() == 'source'">
$context.applyTemplates("source");
</j:when>
<j:otherwise>
<$node.name()$context.applyTemplates("@*")>
<j:foreach item="n" items="$node.children()">
$context.applyTemplates($n)
</j:foreach>
</$node.name()>
</j:otherwise>
</j:choose>
</jsl:template>
</j:jelly>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
