<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:sf="http://sourceforge.net/"
- xmlns:cvs="http://www.red-bean.com/xmlns/cvs2cl/"
- xmlns="http://docbook.org/ns/docbook"
- exclude-result-prefixes="exsl sf cvs"
+ exclude-result-prefixes="exsl sf"
version='1.0'>
<!-- ********************************************************************
$Id$
******************************************************************** -->
- <!-- * the modified-markup.xsl file is a slightly modified version -->
+ <!-- * The modified-markup.xsl file is a slightly modified version -->
<!-- * of Jeni Tennison's "Markup Utility" stylesheet -->
<!-- * -->
<!-- * http://www.jenitennison.com/xslt/utilities/markup.html -->
<!-- ==================================================================== -->
<!-- * This stylesheet converts XML-formatted ChangeLog output of the -->
- <!-- * cvs2cl command into DocBook form. -->
- <!-- * -->
- <!-- * http://www.red-bean.com/cvs2cl/ -->
+ <!-- * "svn log" command into DocBook form. -->
<!-- * -->
<!-- * Features :-->
<!-- * -->
<!-- * XSL stylesheet param names, and marks them up with -->
<!-- * <parameter>hoge.moge.baz</parameter> instances -->
<!-- * -->
- <!-- * - discards newlines, so don't rely on them in your commit messages -->
- <!-- * -->
- <!-- * - converts cvs usernames to corresponding users' real names -->
+ <!-- * - converts usernames to corresponding users' real names -->
<!-- * -->
<xsl:param name="release-version"/>
- <xsl:param name="release-version-ncname">
- <xsl:text>V</xsl:text>
- <xsl:value-of select="translate($release-version, '.', '')"/>
- </xsl:param>
- <xsl:param name="latest-tag">VXXXX</xsl:param>
- <!-- * We get the value of $previous-release by chopping up the latest -->
- <!-- * tag, then putting it back together. With dots. -->
- <xsl:param name="previous-release">
- <xsl:value-of select="
- concat(
- substring($latest-tag, 2, 1),
- '.',
- substring($latest-tag, 3, 2),
- '.',
- substring($latest-tag, 5, 1)
- )"/>
- </xsl:param>
-
- <xsl:strip-space elements="changelog entry"/>
+ <xsl:param name="previous-release"/>
<!-- * $subsections holds a "display name" for each subsection to -->
<!-- * include in the release notes. The lowercase versions of these -->
</sf:user>
</sf:users>
- <xsl:template match="cvs:changelog">
+ <xsl:template match="log">
<xsl:text>
</xsl:text>
<article>
<xsl:text>
</xsl:text>
<xsl:text>
</xsl:text>
<sect1>
<xsl:attribute
- name="xml:id"><xsl:value-of
- select="$release-version-ncname"/></xsl:attribute>
+ name="xml:id">V<xsl:value-of
+ select="$release-version"/></xsl:attribute>
<xsl:text>
</xsl:text>
<title>Release: <xsl:value-of select="$release-version"/></title>
<xsl:text>
</xsl:text>
<!-- * param, popping them off until it depletes the list. -->
<xsl:param name="subsection"/>
<xsl:param name="remaining-subsections"/>
- <!-- * dirname is a lowercase version of the "display name" for -->
- <!-- * each subsection -->
+ <!-- * dirname is a lowercase version of the "display name" for -->
+ <!-- * each subsection -->
<xsl:param name="dirname"
select="translate($subsection,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
<!-- * the entire list and depleted it; so that's the point at which -->
<!-- * the template stops recursing and returns -->
<xsl:if test="not($subsection = '')">
- <sect2>
- <!-- * the ID on each Sect2 is the release version plus the -->
- <!-- * subsection name; for example, xml:id="snapshost_FO" -->
- <xsl:attribute
- name="xml:id"><xsl:value-of
- select="$release-version-ncname"/>_<xsl:value-of select="$subsection"/></xsl:attribute>
- <xsl:text>
</xsl:text>
- <title><xsl:value-of select="$subsection"/></title>
- <xsl:text>
</xsl:text>
- <para>The following changes have been made to the
- <filename><xsl:value-of select="$dirname"/></filename> code
- since the <xsl:value-of select="$previous-release"/> release.</para>
- <xsl:text>
</xsl:text>
- <!-- * We put the commit descriptions into an Itemizedlist, one -->
- <!-- * Item for each commit -->
- <itemizedlist>
+ <!-- * Output a sect2 for this subsection only if with find path names -->
+ <!-- * for changed files in this subsection -->
+ <xsl:if test="logentry[paths/path[starts-with(.,concat('/trunk/xsl/',$dirname,'/'))]]">
+ <sect2>
+ <!-- * the ID on each Sect2 is the release version plus the -->
+ <!-- * subsection name; for example, xml:id="snapshost_FO" -->
+ <xsl:attribute
+ name="xml:id">V<xsl:value-of
+ select="$release-version"/>_<xsl:value-of select="$subsection"/></xsl:attribute>
+ <xsl:text>
</xsl:text>
+ <title><xsl:value-of select="$subsection"/></title>
+ <xsl:text>
</xsl:text>
+ <para>The following changes have been made to the
+ <filename><xsl:value-of select="$dirname"/></filename> code
+ since the <xsl:value-of select="$previous-release"/> release.</para>
+ <xsl:text>
</xsl:text>
+ <!-- * We put the commit descriptions into an Itemizedlist, one -->
+ <!-- * Item for each commit -->
+ <itemizedlist>
+ <xsl:text>
</xsl:text>
+ <xsl:call-template name="format.entries">
+ <xsl:with-param name="dirname" select="$dirname"/>
+ </xsl:call-template>
+ </itemizedlist>
<xsl:text>
</xsl:text>
- <xsl:call-template name="format.entries">
- <xsl:with-param name="dirname" select="$dirname"/>
- </xsl:call-template>
- </itemizedlist>
+ </sect2>
+ <!-- * for example, "end of FO changes for V1691" -->
+ <xsl:comment>end of <xsl:value-of
+ select="$subsection"/> changes for <xsl:value-of
+ select="$release-version"/></xsl:comment>
<xsl:text>
</xsl:text>
- </sect2>
- <!-- * for example, "end of FO changes for V1691" -->
- <xsl:comment>end of <xsl:value-of
- select="$subsection"/> changes for <xsl:value-of
- select="$release-version"/></xsl:comment>
- <xsl:text>
</xsl:text>
- <xsl:text>
</xsl:text>
+ <xsl:text>
</xsl:text>
+ </xsl:if>
<xsl:call-template name="format.subsection">
<!-- * pop the name of the next subsection off the list of -->
<!-- * remaining subsections -->
<xsl:template name="format.entries">
<xsl:param name="dirname"/>
- <xsl:for-each select="cvs:entry[cvs:file/cvs:name[starts-with(.,concat($dirname,'/'))]]">
+ <xsl:for-each
+ select="logentry[paths/path[starts-with(.,concat('/trunk/xsl/',$dirname,'/'))]]">
<!-- * each Lisitem corresponds to a single commit -->
- <listitem role="commit-message">
+ <listitem>
<xsl:text>
</xsl:text>
<!-- * for each entry (commit), get the commit message. Also -->
<!-- * get the filename(s) + revision(s) and username, and -->
- <!-- * put it on the end -->
- <xsl:call-template name="format-message">
- <xsl:with-param name="text" select="string(cvs:msg)"/>
- </xsl:call-template>
- <para role="commit-changes">
- <xsl:text>Modified: </xsl:text>
- <xsl:for-each select="cvs:file">
- <xsl:apply-templates select="."/>
- <xsl:if test="not(position() = last())">
- <xsl:text>; </xsl:text>
- </xsl:if>
- </xsl:for-each>
- <xsl:text> - </xsl:text>
- <xsl:apply-templates select="cvs:author"/>
- </para>
+ <!-- * put it into an Alt element, which will become a Title -->
+ <!-- * element in HTML output, generating "tooltip text"-->
+ <literallayout format="linespecific"
+ ><phrase role="commit-message">
+ <xsl:apply-templates select="msg"/>
+ <alt>
+ <!-- * Only get path names for files that are in the subsection -->
+ <!-- * that we are currently formatting -->
+ <xsl:for-each select="paths/path[starts-with(.,concat('/trunk/xsl/',$dirname,'/'))]">
+ <xsl:apply-templates select="."/>
+ <xsl:if test="not(position() = last())">
+ <xsl:text>; </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ <xsl:text> - </xsl:text>
+ <xsl:apply-templates select="author"/>
+ </alt>
+ </phrase></literallayout>
<xsl:text>
</xsl:text>
</listitem>
<xsl:text>
</xsl:text>
</xsl:for-each>
</xsl:template>
- <xsl:template name="format-message">
- <xsl:param name="text" select="''"/>
- <xsl:choose>
- <xsl:when test="contains($text,'

')">
- <para>
- <xsl:call-template name="add-markup">
- <xsl:with-param name="text"
- select="substring-before($text,'

')"/>
- </xsl:call-template>
- </para>
- <xsl:call-template name="format-message">
- <xsl:with-param name="text"
- select="substring-after($text,'

')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <para>
- <xsl:call-template name="add-markup">
- <xsl:with-param name="text" select="$text"/>
- </xsl:call-template>
- </para>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="add-markup">
- <xsl:param name="text" select="''"/>
-
+ <xsl:template match="msg">
<!-- * trim off any leading and trailing whitespace from this -->
<!-- * commit message -->
<xsl:variable name="trimmed">
<xsl:call-template name="trim.text">
- <xsl:with-param name="contents" select="$text"/>
+ <xsl:with-param name="contents" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="trimmed-contents" select="exsl:node-set($trimmed)"/>
name="phrases"
select="document($element.file)//member|
document($param.file)//member"
- />
+ />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="marked.up" select="exsl:node-set($marked.up.contents)"/>
<!-- * return the marked-up contents, unmasked -->
- <xsl:apply-templates select="$marked.up" mode="restore.period"/>
+ <xsl:apply-templates select="$marked.up" mode="restore.period"/>
</xsl:template>
<!-- * template for matching DocBook element names -->
<xsl:param
name="lowercased-word"
select="translate($word,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
- <!-- * adjust the value of $stopwords by removing all whitepace -->
- <!-- * from it and adding a comma to the beginning and end of it -->
+ <!-- * adjust the value of $stopwords by removing all whitepace -->
+ <!-- * from it and adding a comma to the beginning and end of it -->
<xsl:param
name="adjusted-stopwords"
select="concat(',',translate($stopwords,'	  ',''),',')"/>
<parameter><xsl:value-of select="$word" /></parameter>
</xsl:template>
- <xsl:template match="cvs:file">
- <xsl:value-of
- select="cvs:name"/><xsl:text>,</xsl:text><xsl:value-of
- select="cvs:revision"/>
+ <xsl:template match="path">
+ <xsl:value-of select="@action"/>: <xsl:value-of select="."/>
</xsl:template>
- <xsl:template match="cvs:author">
+ <xsl:template match="author">
<xsl:variable name="username" select="."/>
<!-- * based on Sourceforge cvs username, get a real name and use -->
<!-- * that in the result document, instead of the username -->
- <xsl:value-of
+ <xsl:value-of
select="document('')//sf:users/sf:user[sf:username = $username]/sf:firstname"/>
- <xsl:text> </xsl:text>
- <xsl:value-of
+ <xsl:text> </xsl:text>
+ <xsl:value-of
select="document('')//sf:users/sf:user[sf:username = $username]/sf:surname"/>
</xsl:template>
<xsl:with-param name="target">. </xsl:with-param>
<xsl:with-param name="replacement">;⌂ </xsl:with-param>
<xsl:with-param name="string">
- <xsl:choose>
- <xsl:when test="substring(., string-length(.)) = '.'">
- <xsl:value-of
- select="concat(substring(.,1,string-length(.) - 1),';⌂')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="."/>
- </xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="substring(., string-length(.)) = '.'">
+ <xsl:value-of
+ select="concat(substring(.,1,string-length(.) - 1),';⌂')"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
</xsl:choose>
</xsl:with-param>
</xsl:call-template>
<!-- * unwind results of mask.period - and, as a bonus, convert all -->
<!-- * newlines characters to instances of a"linebreak element" -->
<xsl:template match="text()" mode="restore.period">
- <xsl:call-template name="newlines.to.linebreak.element">
- <xsl:with-param name="string">
- <xsl:call-template name="string.subst">
- <xsl:with-param name="string" select="."/>
- <xsl:with-param name="target">;⌂</xsl:with-param>
- <xsl:with-param name="replacement">.</xsl:with-param>
- </xsl:call-template>
- </xsl:with-param>
+ <xsl:call-template name="string.subst">
+ <xsl:with-param name="string" select="."/>
+ <xsl:with-param name="target">;⌂</xsl:with-param>
+ <xsl:with-param name="replacement">.</xsl:with-param>
</xsl:call-template>
+
</xsl:template>
<xsl:template match="*" mode="restore.period">
<xsl:copy-of select="."/>
</xsl:template>
- <!-- * ============================================================== -->
- <!-- * Utility template for preserving linebreaks in output -->
- <!-- * ============================================================== -->
- <xsl:template name="newlines.to.linebreak.element">
- <xsl:param name="string"/>
- <xsl:param name="linebreak.element"><sbr /></xsl:param>
- <xsl:choose>
- <xsl:when test="contains($string, '
')">
- <xsl:value-of select="substring-before($string, '
')" />
- <xsl:copy-of select="$linebreak.element" />
- <xsl:call-template name="newlines.to.linebreak.element">
- <xsl:with-param name="string"
- select="substring-after($string, '
')" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$string" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
</xsl:stylesheet>
-