pass locale into named templates as parem; major improvements to auto-documentation

This commit is contained in:
sb 2009-05-13 17:52:33 +00:00
parent b87e01bd64
commit 3e8306ca6c
2 changed files with 452 additions and 279 deletions

View file

@ -14,7 +14,7 @@
<xsl:param name="detail" select="full"/> <xsl:param name="detail" select="full"/>
<xsl:template match="adl:application"> <xsl:template match="adl:application">
<html xmlns="http://www.w3.org/1999/xhtml"> <html>
<head> <head>
<title> <title>
Data definition for the <xsl:value-of select="@name"/> application Data definition for the <xsl:value-of select="@name"/> application
@ -42,232 +42,353 @@
</xsl:if> </xsl:if>
<xsl:apply-templates select="adl:documentation"/> <xsl:apply-templates select="adl:documentation"/>
<h2>Contents</h2> <h2>Contents</h2>
<dl> <dl>
<xsl:for-each select="adl:entity"> <dt>Entities</dt>
<dt> <dd>
<a> <dl>
<xsl:attribute name="href"> <xsl:for-each select="adl:entity">
<xsl:value-of select="concat( '#entity-', @name)"/> <dt>
</xsl:attribute> <a>
<xsl:value-of select="@name"/> <xsl:attribute name="href">
</a> <xsl:value-of select="concat( '#entity-', @name)"/>
</dt> </xsl:attribute>
<dd> <xsl:value-of select="@name"/>
<xsl:value-of select="adl:documentation"/> </a>
</dd> </dt>
</xsl:for-each> <dd>
</dl> <xsl:value-of select="adl:documentation"/>
<xsl:for-each select="adl:entity"> </dd>
<a> </xsl:for-each>
<xsl:attribute name="name"> </dl>
<xsl:value-of select="concat( 'entity-', @name)"/> </dd>
</xsl:attribute> <dt>Defined types</dt>
</a> <dd>
<hr/> <dl>
<h2> <xsl:for-each select="adl:typedef">
<xsl:value-of select="@name" /> <dt>
</h2> <a>
<xsl:apply-templates select="adl:documentation"/> <xsl:attribute name="href">
<h3>Access control</h3> <xsl:value-of select="concat( '#typedef-', @name)"/>
<table> </xsl:attribute>
<tr> <xsl:value-of select="@name"/>
<th>Group</th> </a>
<th>Permission</th> </dt>
</tr> </xsl:for-each>
<xsl:for-each select="adl:permission"> </dl>
<tr> </dd>
<td> <dt>Security groups</dt>
<xsl:value-of select="@group"/> <dd>
</td> <dl>
<td> <xsl:for-each select="adl:group">
<xsl:value-of select="@permission"/> <dt>
</td> <a>
</tr> <xsl:attribute name="href">
</xsl:for-each> <xsl:value-of select="concat( '#group-', @name)"/>
</table> </xsl:attribute>
<h3>Properties</h3> <xsl:value-of select="@name"/>
<table> </a>
<tr class="header"> </dt>
<th>Property</th> </xsl:for-each>
<th>Type</th> </dl>
<xsl:if test="$detail = 'full'"> </dd>
<th>Req'd</th> </dl>
<th>Def'lt</th> <hr/>
<th>Size</th> <h2>Entities</h2>
<th>Distinct</th> <xsl:apply-templates select="adl:entity"/>
<th>Prompt</th> <hr/>
</xsl:if> <h2>
</tr> Type Definitions
<xsl:for-each select=".//adl:property" > </h2>
<xsl:variable name="rowclass"> <xsl:apply-templates select="adl:typedef"/>
<xsl:choose> <hr/>
<xsl:when test="position() mod 2 = 0">even</xsl:when> <h2>Security groups</h2>
<xsl:otherwise>odd</xsl:otherwise> <xsl:apply-templates select="adl:group"/>
</xsl:choose>
</xsl:variable>
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<th>
<xsl:value-of select="@name"/>&#160;
</th>
<td>
<xsl:value-of select="@type"/>
<xsl:choose>
<xsl:when test="@type='entity'">
of type <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#entity-', @entity)"/>
</xsl:attribute>
<xsl:value-of select="@entity"/>
</a>
</xsl:when>
<xsl:when test="@type = 'link'">
(many to many) to entities of type <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#entity-', @entity)"/>
</xsl:attribute>
<xsl:value-of select="@entity"/>
</a>
</xsl:when>
<xsl:when test="@type = 'list'">
<xsl:choose>
<xsl:when test="@required='true'">
(one to one-or-many)
</xsl:when>
<xsl:otherwise>
(one to zero-or-many)
</xsl:otherwise>
</xsl:choose>
of entities of type <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#entity-', @entity)"/>
</xsl:attribute>
<xsl:value-of select="@entity"/>
</a>
</xsl:when>
<xsl:when test="@definition">
:
<xsl:variable name="definition">
<xsl:value-of select="@definition"/>
</xsl:variable>
<xsl:variable name="defined-type">
<xsl:value-of select="/adl:application/adl:definition[@name=$definition]/@type"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$defined-type = 'string'">
String matching
"<xsl:value-of select="/adl:application/adl:definition[@name=$definition]/@pattern"/>"
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/adl:application/adl:definition[@name=$definition]/@minimum"/> &lt;
<xsl:value-of select="@definition"/> &lt;
<xsl:value-of select="/adl:application/adl:definition[@name=$definition]/@maximum"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</td>
<xsl:if test="$detail = 'full'">
<td>
<xsl:value-of select="@required"/>&#160;
</td>
<td>
<xsl:value-of select="@default"/>&#160;
</td>
<td>
<xsl:value-of select="@size"/>&#160;
</td>
<td>
<xsl:value-of select="@distinct"/>&#160;
</td>
<td>
<xsl:for-each select="adl:prompt">
<xsl:apply-templates select="adl:prompt"/>&#160;
</xsl:for-each>
</td>
</xsl:if>
</tr>
<xsl:if test="adl:option">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>
<xsl:attribute name="rowspan">
<xsl:value-of select="count( adl:option)"/>
</xsl:attribute>
Options:
</td>
<td>
<xsl:apply-templates select="adl:option[ position()=1]"/>
</td>
<xsl:for-each select="adl:option[position() &gt; 1]">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>
<xsl:apply-templates select="."/>
</td>
</tr>
</xsl:for-each>
</tr>
</xsl:if>
<xsl:if test="adl:help">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>
<td>Helptext:</td>
<td>
<xsl:attribute name="colspan">
<xsl:choose>
<xsl:when test="$detail='full'">7</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="adl:help"/>
</td>
</td>
</tr>
</xsl:if>
<xsl:if test="adl:documentation">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>Documentation:</td>
<td>
<xsl:attribute name="colspan">
<xsl:choose>
<xsl:when test="$detail='full'">7</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="adl:documentation"/>
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
<xsl:apply-templates select="form"/>
<xsl:apply-templates select="list"/>
<xsl:apply-templates select="page"/>
<a href="#top">[back to top]</a>
</xsl:for-each>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
<xsl:template match="adl:entity">
<hr/>
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat( 'entity-', @name)"/>
</xsl:attribute>
</a>
<h3>
<xsl:value-of select="@name" />
</h3>
<xsl:apply-templates select="adl:documentation"/>
<h4>Access control</h4>
<table>
<tr>
<th>Group</th>
<th>Permission</th>
</tr>
<xsl:for-each select="adl:permission">
<tr>
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#group-', @group)"/>
</xsl:attribute>
<xsl:value-of select="@group"/>
</a>
</td>
<td>
<xsl:value-of select="@permission"/>
</td>
</tr>
</xsl:for-each>
</table>
<h4>User interface</h4>
<ul>
<xsl:for-each select="adl:page|adl:list|adl:form">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#page-', ancestor::adl:entity/@name, '-', @name)"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</ul>
<h4>Properties</h4>
<table>
<tr class="header">
<th>Property</th>
<th>Type</th>
<xsl:if test="not( $detail) or $detail = 'full'">
<th>Req'd</th>
<th>Def'lt</th>
<th>Size</th>
<th>Distinct</th>
<th>Prompt</th>
<th>Security overrides</th>
</xsl:if>
</tr>
<xsl:apply-templates select=".//adl:property" />
</table>
<xsl:apply-templates select="adl:form"/>
<xsl:apply-templates select="adl:list"/>
<xsl:apply-templates select="adl:page"/>
<a href="#top">[back to top]</a>
</xsl:template>
<xsl:template match="adl:property">
<xsl:variable name="rowclass">
<xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when>
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat( 'property-', ancestor::adl:entity/@name, '-', @name)"/>
</xsl:attribute>
</a>
<th>
<xsl:value-of select="@name"/>&#160;
</th>
<td>
<xsl:value-of select="@type"/>
<xsl:choose>
<xsl:when test="@type='entity'">
of type <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#entity-', @entity)"/>
</xsl:attribute>
<xsl:value-of select="@entity"/>
</a>
</xsl:when>
<xsl:when test="@type = 'link'">
(many to many) to entities of type <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#entity-', @entity)"/>
</xsl:attribute>
<xsl:value-of select="@entity"/>
</a>
</xsl:when>
<xsl:when test="@type = 'list'">
<xsl:choose>
<xsl:when test="@required='true'">
(one to one-or-many)
</xsl:when>
<xsl:otherwise>
(one to zero-or-many)
</xsl:otherwise>
</xsl:choose>
of entities of type <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#entity-', @entity)"/>
</xsl:attribute>
<xsl:value-of select="@entity"/>
</a>
</xsl:when>
<xsl:when test="@type='defined'">
as <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#typedef-', @typedef)"/>
</xsl:attribute>
<xsl:value-of select="@typedef"/>
</a>
</xsl:when>
</xsl:choose>
</td>
<xsl:if test="not( $detail) or $detail = 'full'">
<td>
<xsl:value-of select="@required"/>&#160;
</td>
<td>
<xsl:value-of select="@default"/>&#160;
</td>
<td>
<xsl:value-of select="@size"/>&#160;
</td>
<td>
<xsl:value-of select="@distinct"/>&#160;
</td>
<td>
<xsl:apply-templates select="adl:prompt"/>&#160;
</td>
<td>
<dl>
<xsl:for-each select="adl:permission">
<dt>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#group-', @group)"/>
</xsl:attribute>
<xsl:value-of select="@group"/>
</a>
</dt>
<dd>
<xsl:value-of select="@permission"/>
</dd>
</xsl:for-each>
</dl>
</td>
</xsl:if>
</tr>
<xsl:if test="adl:option">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>
<xsl:attribute name="rowspan">
<xsl:value-of select="count( adl:option)"/>
</xsl:attribute>
Options:
</td>
<td colspan="7">
<xsl:apply-templates select="adl:option[ position()=1]"/>
</td>
<xsl:for-each select="adl:option[position() &gt; 1]">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td colspan="7">
<xsl:apply-templates select="."/>
</td>
</tr>
</xsl:for-each>
</tr>
</xsl:if>
<xsl:if test="adl:help">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>
<td>Helptext:</td>
<td>
<xsl:attribute name="colspan">
<xsl:choose>
<xsl:when test="$detail='full'">7</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="adl:help"/>
</td>
</td>
</tr>
</xsl:if>
<xsl:if test="adl:documentation">
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$rowclass"/>
</xsl:attribute>
<td>Documentation:</td>
<td>
<xsl:attribute name="colspan">
<xsl:choose>
<xsl:when test="$detail='full'">7</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="adl:documentation"/>
</td>
</tr>
</xsl:if>
</xsl:template>
<xsl:template match="adl:typedef">
<hr/>
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat( 'typedef-', @name)"/>
</xsl:attribute>
</a>
<h3>
<xsl:value-of select="@name" />
</h3>
<p>
<xsl:choose>
<xsl:when test="@type = 'string'">
String matching
"<xsl:value-of select="@pattern"/>"
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@minimum"/> &lt;
<xsl:value-of select="@typedef"/> &lt;
<xsl:value-of select="@maximum"/>
</xsl:otherwise>
</xsl:choose>
</p>
<xsl:apply-templates select="adl:documentation"/>
<a href="#top">[back to top]</a>
</xsl:template>
<xsl:template match="adl:group">
<hr/>
<a>
<xsl:attribute name="name">
<xsl:value-of select="concat( 'group-', @name)"/>
</xsl:attribute>
</a>
<h3>
<xsl:value-of select="@name" />
</h3>
<xsl:apply-templates select="adl:documentation"/>
<a href="#top">[back to top]</a>
</xsl:template>
<xsl:template match="adl:prompt"> <xsl:template match="adl:prompt">
<!-- If I'm the prompt for the current locale, show me; <!-- If I'm the prompt for the current locale, show me;
if I'm the default prompt, show me only if there isn't if I'm the default prompt, show me only if there isn't
one for the default locale --> one for the default locale -->
<xsl:choose> <xsl:choose>
<xsl:when test="@locale=$locale"> <xsl:when test="not($locale) and @locale='en-GB'">
<!-- something's not right with the locale parameter? -->
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@locale=$locale">
<xsl:value-of select="@prompt"/> <xsl:value-of select="@prompt"/>
</xsl:when> </xsl:when>
<xsl:when test="@locale='default'"> <xsl:when test="@locale='default'">
@ -279,6 +400,7 @@
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<xsl:apply-templates/>
</xsl:template> </xsl:template>
<xsl:template match="adl:help"> <xsl:template match="adl:help">
@ -286,6 +408,10 @@
if I'm the default helptext, show me only if there isn't if I'm the default helptext, show me only if there isn't
one for the default locale --> one for the default locale -->
<xsl:choose> <xsl:choose>
<xsl:when test="not($locale) and @locale='en-GB'">
<!-- something's not right with the locale parameter? -->
<xsl:apply-templates/>
</xsl:when>
<xsl:when test="@locale=$locale"> <xsl:when test="@locale=$locale">
<xsl:apply-templates/> <xsl:apply-templates/>
</xsl:when> </xsl:when>
@ -301,10 +427,10 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:documentation"> <xsl:template match="adl:documentation">
<div xmlns="http://www.w3.org/1999/xhtml" class="documentation"> <div class="documentation">
<xsl:value-of select="."/> <xsl:value-of select="."/>
<xsl:if test="adl:reference"> <xsl:if test="adl:reference">
<h4>See also</h4> <h5>See also</h5>
<ul> <ul>
<xsl:apply-templates select="adl:reference"/> <xsl:apply-templates select="adl:reference"/>
</ul> </ul>
@ -315,7 +441,7 @@
<xsl:template match="adl:reference"> <xsl:template match="adl:reference">
<xsl:variable name="abbr" select="@abbr"/> <xsl:variable name="abbr" select="@abbr"/>
<xsl:variable name="specification" select="/adl:application/adl:specification[@abbr=$abbr]"/> <xsl:variable name="specification" select="/adl:application/adl:specification[@abbr=$abbr]"/>
<li xmlns="http://www.w3.org/1999/xhtml"> <li>
<xsl:choose> <xsl:choose>
<xsl:when test="@entity"> <xsl:when test="@entity">
<a> <a>
@ -329,7 +455,7 @@
</a> </a>
</xsl:when> </xsl:when>
<xsl:when test="$specification/@url"> <xsl:when test="$specification/@url">
<a xmlns="http://www.w3.org/1999/xhtml"> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:choose> <xsl:choose>
<xsl:when test="@section"> <xsl:when test="@section">
@ -359,20 +485,31 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:form"> <xsl:template match="adl:form">
<div xmlns="http://www.w3.org/1999/xhtml"> <div class="form">
<h3 xmlns="http://www.w3.org/1999/xhtml"> <a>
Form <xsl:value-of select="@name"/> <xsl:attribute name="name">
</h3> <xsl:value-of select="concat('page-', ancestor::adl:entity/@name, '-', @name)"/>
</xsl:attribute>
</a>
<h4>
Form '<xsl:value-of select="@name"/>' of entity
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#entity-', ancestor::adl:entity/@name)"/>
</xsl:attribute>
<xsl:value-of select="ancestor::adl:entity/@name"/>
</a>
</h4>
<xsl:if test="adl:permission"> <xsl:if test="adl:permission">
<h4 xmlns="http://www.w3.org/1999/xhtml">Permissions</h4> <h5>Permissions</h5>
<ul xmlns="http://www.w3.org/1999/xhtml"> <ul>
<xsl:apply-templates select="permission"/> <xsl:apply-templates select="permission"/>
</ul> </ul>
</xsl:if> </xsl:if>
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='listed'"> <xsl:when test="@properties='listed'">
<p>Showing the following properties</p> <p>Showing the following properties</p>
<table xmlns="http://www.w3.org/1999/xhtml"> <table>
<tr> <tr>
<th>&#160;</th> <th>&#160;</th>
<th>Property</th> <th>Property</th>
@ -390,19 +527,30 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:page"> <xsl:template match="adl:page">
<div xmlns="http://www.w3.org/1999/xhtml"> <div class="page">
<h3 xmlns="http://www.w3.org/1999/xhtml"> <a>
Page <xsl:value-of select="@name"/> <xsl:attribute name="name">
</h3> <xsl:value-of select="concat('page-', ancestor::adl:entity/@name, '-', @name)"/>
</xsl:attribute>
</a>
<h4>
Page '<xsl:value-of select="@name"/>' of entity
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#entity-', ancestor::adl:entity/@name)"/>
</xsl:attribute>
<xsl:value-of select="ancestor::adl:entity/@name"/>
</a>
</h4>
<xsl:if test="adl:permission"> <xsl:if test="adl:permission">
<ul xmlns="http://www.w3.org/1999/xhtml"> <ul>
<xsl:apply-templates select="permission"/> <xsl:apply-templates select="permission"/>
</ul> </ul>
</xsl:if> </xsl:if>
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='listed'"> <xsl:when test="@properties='listed'">
<p>Showing the following properties</p> <p>Showing the following properties</p>
<table xmlns="http://www.w3.org/1999/xhtml"> <table>
<tr> <tr>
<th>&#160;</th> <th>&#160;</th>
<th>Property</th> <th>Property</th>
@ -420,19 +568,36 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:list"> <xsl:template match="adl:list">
<div xmlns="http://www.w3.org/1999/xhtml"> <div class="list">
<h3 xmlns="http://www.w3.org/1999/xhtml"> <a>
List <xsl:value-of select="@name"/>, on select <xsl:value-of select="@onselect"/> <xsl:attribute name="name">
</h3> <xsl:value-of select="concat('page-', ancestor::adl:entity/@name, '-', @name)"/>
</xsl:attribute>
</a>
<h4>
List '<xsl:value-of select="@name"/>' of entity
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat('#entity-', ancestor::adl:entity/@name)"/>
</xsl:attribute>
<xsl:value-of select="ancestor::adl:entity/@name"/>
</a>, on select
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#page-', ancestor::adl:entity/@name, '-', @onselect)"/>
</xsl:attribute>
<xsl:value-of select="@onselect"/>
</a>
</h4>
<xsl:if test="adl:permission"> <xsl:if test="adl:permission">
<ul xmlns="http://www.w3.org/1999/xhtml"> <ul>
<xsl:apply-templates select="adl:permission"/> <xsl:apply-templates select="adl:permission"/>
</ul> </ul>
</xsl:if> </xsl:if>
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='listed'"> <xsl:when test="@properties='listed'">
<p>Showing the following properties</p> <p>Showing the following properties</p>
<table xmlns="http://www.w3.org/1999/xhtml"> <table>
<tr> <tr>
<th>&#160;</th> <th>&#160;</th>
<th>Property</th> <th>Property</th>
@ -450,7 +615,7 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:field"> <xsl:template match="adl:field">
<tr xmlns="http://www.w3.org/1999/xhtml"> <tr>
<xsl:attribute name="class"> <xsl:attribute name="class">
<xsl:choose> <xsl:choose>
<xsl:when test="parent::adl:fieldgroup"> <xsl:when test="parent::adl:fieldgroup">
@ -469,7 +634,12 @@
</xsl:attribute> </xsl:attribute>
<td>Field</td> <td>Field</td>
<td> <td>
<xsl:value-of select="@property"/> <a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '#property-', ancestor::adl:entity/@name, '-', @property)"/>
</xsl:attribute>
<xsl:value-of select="@property"/>
</a>
</td> </td>
<td> <td>
<xsl:apply-templates select="adl:prompt"/> <xsl:apply-templates select="adl:prompt"/>
@ -482,7 +652,7 @@
</td> </td>
</tr> </tr>
<xsl:if test="adl:permission"> <xsl:if test="adl:permission">
<tr xmlns="http://www.w3.org/1999/xhtml"> <tr>
<td></td> <td></td>
<td colspan="3"> <td colspan="3">
<xsl:apply-templates select="adl:permission"/> <xsl:apply-templates select="adl:permission"/>
@ -493,7 +663,7 @@
<xsl:template match="adl:verb"> <xsl:template match="adl:verb">
<tr xmlns="http://www.w3.org/1999/xhtml"> <tr>
<xsl:attribute name="class"> <xsl:attribute name="class">
<xsl:choose> <xsl:choose>
<xsl:when test="parent::adl:fieldgroup"> <xsl:when test="parent::adl:fieldgroup">
@ -526,7 +696,7 @@
</td> </td>
</tr> </tr>
<xsl:if test="adl:permission"> <xsl:if test="adl:permission">
<tr xmlns="http://www.w3.org/1999/xhtml"> <tr>
<td></td> <td></td>
<td colspan="3"> <td colspan="3">
<xsl:apply-templates select="adl:permission"/> <xsl:apply-templates select="adl:permission"/>
@ -538,7 +708,7 @@
<xsl:template match="adl:auxlist"> <xsl:template match="adl:auxlist">
<tr xmlns="http://www.w3.org/1999/xhtml" class="auxlist-start"> <tr class="auxlist-start">
<th>Auxlist</th> <th>Auxlist</th>
<th> <th>
<xsl:value-of select="@property"/> <xsl:value-of select="@property"/>
@ -553,10 +723,27 @@
<xsl:apply-templates select="adl:documentation"/> <xsl:apply-templates select="adl:documentation"/>
</th> </th>
</tr> </tr>
<tr xmlns="http://www.w3.org/1999/xhtml" class="auxlist"> <tr class="auxlist">
<th>On select:</th> <th>
<xsl:if test="@onselect">On select:</xsl:if></th>
<td> <td>
<xsl:value-of select="@onselect"/> <a>
<xsl:attribute name="href">
<xsl:variable name="propname" select="@property"/>
<xsl:variable name="targetent">
<xsl:choose>
<xsl:when test="ancestor::adl:entity//adl:property[@name=$propname]/@entity">
<xsl:value-of select="ancestor::adl:entity//adl:property[@name=$propname]/@entity"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="ancestor::adl:entity/@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat( '#page-', $targetent, '-', @onselect)"/>
</xsl:attribute>
<xsl:value-of select="@onselect"/>
</a>
</td> </td>
<td colspan="2"> <td colspan="2">
<xsl:choose> <xsl:choose>
@ -573,8 +760,8 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:fieldgroup"> <xsl:template match="adl:fieldgroup">
<tr xmlns="http://www.w3.org/1999/xhtml" class="fieldgroup-start"> <tr class="fieldgroup-start">
<th>Auxlist</th> <th>Field group</th>
<th> <th>
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
</th> </th>
@ -588,22 +775,6 @@
<xsl:apply-templates select="adl:documentation"/> <xsl:apply-templates select="adl:documentation"/>
</th> </th>
</tr> </tr>
<tr xmlns="http://www.w3.org/1999/xhtml" class="adl:auxlist">
<th>On select:</th>
<td>
<xsl:value-of select="@onselect"/>
</td>
<td colspan="2">
<xsl:choose>
<xsl:when test="@properties='listed'">
Showing the following properties
</xsl:when>
<xsl:otherwise>
Showing all properties
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
<xsl:apply-templates select="adl:field|adl:fieldgroup|adl:auxlist|adl:verb"/> <xsl:apply-templates select="adl:field|adl:fieldgroup|adl:auxlist|adl:verb"/>
</xsl:template> </xsl:template>
@ -613,7 +784,7 @@
: <xsl:apply-templates select="adl:prompt"/> : <xsl:apply-templates select="adl:prompt"/>
</xsl:if> </xsl:if>
<xsl:if test="adl:help"> <xsl:if test="adl:help">
(<i xmlns="http://www.w3.org/1999/xhtml"> (<i>
<xsl:apply-templates select="adl:prompt"/> <xsl:apply-templates select="adl:prompt"/>
</i>) </i>)
</xsl:if> </xsl:if>

View file

@ -15,28 +15,27 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.60 $ $Revision: 1.61 $
$Date: 2009-05-12 15:43:18 $ $Date: 2009-05-13 17:52:33 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! --> Whitespace (or lack of it) is significant! -->
<xsl:include href="base-type-include.xslt"/> <xsl:include href="base-type-include.xslt"/>
<xsl:include href="permissions-include.xslt"/> <xsl:include href="permissions-include.xslt"/>
<!-- bug 1896 : boilerplate text in views should be tailored to the locale of
the expected user. Unfortunately I haven't yet worked out how to do
conditional includes in XSLT, so this is a step on the way to a solution,
not a solution in itself. -->
<xsl:include href="i18n-en-GB-include.xslt"/>
<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/> <xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
<!-- The locale for which these views are generated <!-- The locale for which these views are generated
TODO: we need to generate views for each available locale, but this is not TODO: we need to generate views for each available locale, but this is not
yet implemented. When it is we will almost certainly still need a 'default locale' --> yet implemented. When it is we will almost certainly still need a 'default locale' -->
<xsl:param name="locale" select="en-GB"/> <xsl:param name="locale" select="en-GB"/>
<!-- bug 1896 : boilerplate text in views should be tailored to the locale of
the expected user. Unfortunately I haven't yet worked out how to do
conditional includes in XSLT, so this is a step on the way to a solution,
not a solution in itself. -->
<xsl:include href="i18n-en-GB-include.xslt"/>
<!-- whether or not to auto-generate site navigation - by default, don't --> <!-- whether or not to auto-generate site navigation - by default, don't -->
<xsl:param name="generate-site-navigation" select="'false'"/> <xsl:param name="generate-site-navigation" select="'false'"/>
@ -288,6 +287,7 @@
<xsl:call-template name="head"/> <xsl:call-template name="head"/>
<xsl:call-template name="generate-head-javascript"> <xsl:call-template name="generate-head-javascript">
<xsl:with-param name="form" select="."/> <xsl:with-param name="form" select="."/>
<xsl:with-param name="locale" select="$locale"/>
</xsl:call-template> </xsl:call-template>
${StylesHelper.InstallStylesheet( "Epoch")} ${StylesHelper.InstallStylesheet( "Epoch")}
@ -351,6 +351,7 @@
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
<xsl:call-template name="generate-head-javascript"> <xsl:call-template name="generate-head-javascript">
<xsl:with-param name="form" select="."/> <xsl:with-param name="form" select="."/>
<xsl:with-param name="locale" select="$locale"/>
</xsl:call-template> </xsl:call-template>
${StylesHelper.InstallStylesheet( "Epoch")} ${StylesHelper.InstallStylesheet( "Epoch")}
@ -1501,6 +1502,7 @@
<xsl:param name="form"> <xsl:param name="form">
<!-- assumed to be an instance of adl:form --> <!-- assumed to be an instance of adl:form -->
</xsl:param> </xsl:param>
<xsl:param name="locale"/>
<script type='text/javascript' language='JavaScript1.2'> <script type='text/javascript' language='JavaScript1.2'>
#if ( ${site-root}) #if ( ${site-root})
var siteRoot = '$siteRoot'; var siteRoot = '$siteRoot';
@ -1848,7 +1850,7 @@
Auto generated Velocity macro for <xsl:value-of select="@name"/>, Auto generated Velocity macro for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.60 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.61 $', 10)"/>
Generation parameters were: Generation parameters were:
area-name: <xsl:value-of select="$area-name"/> area-name: <xsl:value-of select="$area-name"/>
default-url: <xsl:value-of select="$default-url"/> default-url: <xsl:value-of select="$default-url"/>