<!-- Version: $Id: bugs2html.xsl,v 1.3 2007/03/06 04:16:31 fsasaki Exp $-->
<!DOCTYPE xsl:transform [
<!ENTITY % specinfo SYSTEM "bugs2html-specinfo.dtd">
%specinfo;
]>
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs">
    <xsl:output method="xhtml" encoding="UTF-8" omit-xml-declaration="no"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>

    <xsl:variable name="comments-total" select="count(//bug)"/>
    <xsl:variable name="wgAcceptsComment" select="&wgAcceptsCommentXPath;"/>
    <xsl:variable name="wgRejectsComment" select="&wgRejectsCommentXPath;"/>
    <xsl:variable name="reviewerSatisfied" select="&reviewerSatisfiedXPath;"/>
    <xsl:variable name="reviewerNotSatisfied" select="&reviewerNotSatisfiedXPath;"/>
    <xsl:variable name="noResponse" select="&noResponseXPath;"/>
    <xsl:variable name="wgAcceptsCommentReviewerSatisfied"
        select="$wgAcceptsComment intersect $reviewerSatisfied"/>
    <xsl:variable name="wgAcceptsCommentReviewerNotSatisfied"
        select="$wgAcceptsComment intersect $reviewerNotSatisfied"/>
    <xsl:variable name="wgAcceptsCommentNoResponse" select="$wgAcceptsComment intersect $noResponse"/>
    <xsl:variable name="wgRejectsCommentReviewerSatisfied"
        select="$wgRejectsComment intersect $reviewerSatisfied"/>
    <xsl:variable name="wgRejectsCommentReviewerNotSatisfied"
        select="$wgRejectsComment intersect $reviewerNotSatisfied"/>
    <xsl:variable name="wgRejectsCommentNoResponse" select="$wgRejectsComment intersect $noResponse"/>
    <xsl:variable name="nonEditorialChange" select="&nonEditorialChangeXPath;"/>
    <xsl:variable name="externalComments" select="&externalCommentsXPath;"/>

    <xsl:template name="referenceIssues">
        <xsl:param name="issueStatus">notset</xsl:param>
        <xsl:param name="issueList">notSet</xsl:param>
        <xsl:param name="issueDesc">notSet</xsl:param>
        <xsl:variable name="issueTypeTotal" select="count($issueList)"/>
        <p xmlns="http://www.w3.org/1999/xhtml">
            <span class="{$issueStatus}">
                <xsl:value-of select="$issueDesc"/>
            </span>
        </p>
        <p xmlns="http://www.w3.org/1999/xhtml">
            <xsl:text>Total number: </xsl:text>
            <xsl:value-of select="$issueTypeTotal"/>
            <xsl:if test="$issueTypeTotal > 0">
                <xsl:text> (</xsl:text>
                <xsl:value-of
                    select="round-half-to-even((($issueTypeTotal div $comments-total) * 100),2)"/>
                <xsl:text>%)</xsl:text>
            </xsl:if>
            <xsl:text>.</xsl:text>
        </p>
        <xsl:if test="$issueList">
            <p xmlns="http://www.w3.org/1999/xhtml">
                <xsl:for-each select="$issueList">
                    <xsl:sort select="bug_id"/>
                    <xsl:text> </xsl:text>
                    <a href="{concat('#','issue-',bug_id)}">
                        <xsl:value-of select="bug_id"/>
                    </a>
                </xsl:for-each>
            </p>
        </xsl:if>
    </xsl:template>

    <xsl:template match="/">
        <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
                <title>&specTitle; Disposition of Comments</title>
                <style type="text/css"> tr {background: #ddd;} table.issue {} *.noResponse {
                    background: #bbf; border: 2px solid #f33 } *.changeDeclined { background: #fdc;
                    border: 3px dotted #f33 } </style>
            </head>
            <body>
                <h1>&specTitle; Disposition of Comments</h1>
                <div>
                    <p>This is the Disposition of Comments for the &specPubDate;
                        &specStatus; of the &specLink;. This document lists the comments
                        received during the &specStatus; period and the extent to which the
                        &wg; believes they have been addressed. </p>
                </div>

                <p>Last update: <xsl:value-of select="substring-before(string(current-date()),'+')"
                    />.</p>
                <h2>1. Overview of Comments</h2>
                <p>Total number of comments: <xsl:value-of select="$comments-total"/></p>
                <h3>1.1 Reaction of the Working Group and (dis)satisfaction of the Reviewer</h3>

                <table width="100%">
                    <tr>
                        <td>-</td>
                        <td>
                            <a href="#reviewerSatisfied-listed">Reviewer satisfied</a>
                        </td>
                        <td>
                            <a href="#reviewerNotSatisfied-listed">Reviewer not satisfied</a>
                        </td>
                        <td>
                            <a href="#noResponse-listed">No reply from reviewer</a>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="#proposalAccepted-listed">WG accepted comment</a>
                        </td>
                        <td>
                            <xsl:value-of select="count($wgAcceptsCommentReviewerSatisfied)"/>
                        </td>
                        <td>
                            <xsl:value-of select="count($wgAcceptsCommentReviewerNotSatisfied)"/>
                        </td>
                        <td>
                            <xsl:value-of select="count($wgAcceptsCommentNoResponse)"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <a href="#changeDeclined-listed">WG rejects comment</a>
                        </td>
                        <td>
                            <xsl:value-of select="count($wgRejectsCommentReviewerSatisfied)"/>
                        </td>
                        <td>
                            <xsl:value-of select="count($wgRejectsCommentReviewerNotSatisfied)"/>
                        </td>
                        <td>
                            <xsl:value-of select="count($wgRejectsCommentNoResponse)"/>
                        </td>
                    </tr>
                </table>
                <h3>1.2 List of Comments per Category</h3>
                <ul>
                    <li id="reviewerNotSatisfied-listed" name="reviewerNotSatisfied-listed">
                        <xsl:call-template name="referenceIssues">
                            <xsl:with-param name="issueStatus">reviewerNotSatisfied</xsl:with-param>
                            <xsl:with-param name="issueList" select="$reviewerNotSatisfied"/>
                            <xsl:with-param name="issueDesc">The reviewer is not satisfied with the
                                response of the Working Group.</xsl:with-param>
                        </xsl:call-template>
                    </li>
                    <li name="reviewerSatisfied-listed" id="reviewerSatisfied-listed">
                        <xsl:call-template name="referenceIssues">
                            <xsl:with-param name="issueStatus">reviewerSatisfied</xsl:with-param>
                            <xsl:with-param name="issueList" select="$reviewerSatisfied"/>
                            <xsl:with-param name="issueDesc">The reviewer is satisfied with the
                                response of the Working Group.</xsl:with-param>
                        </xsl:call-template>
                    </li>
                    <li id="changeDeclined-listed" name="changeDeclined-listed">
                        <xsl:call-template name="referenceIssues">
                            <xsl:with-param name="issueStatus">changeDeclined</xsl:with-param>
                            <xsl:with-param name="issueList" select="$wgRejectsComment"/>
                            <xsl:with-param name="issueDesc">The Working Group declined to implement
                                the change which the reviewer requested.</xsl:with-param>
                        </xsl:call-template>
                    </li>
                    <li id="noResponse-listed" name="noResponse-listed">
                        <xsl:call-template name="referenceIssues">
                            <xsl:with-param name="issueStatus">noResponse</xsl:with-param>
                            <xsl:with-param name="issueList" select="$noResponse"/>
                            <xsl:with-param name="issueDesc">The reviewer did not respond to the
                                decision of the Working Group.</xsl:with-param>
                        </xsl:call-template>
                    </li>
                    <li id="proposalAccepted-listed" name="proposalAccepted-listed">
                        <xsl:call-template name="referenceIssues">
                            <xsl:with-param name="issueStatus">FIXED</xsl:with-param>
                            <xsl:with-param name="issueList" select="$wgAcceptsComment"/>
                            <xsl:with-param name="issueDesc">The Working Group has accepted the
                                proposal of the reviewer.</xsl:with-param>
                        </xsl:call-template>
                    </li>
                    <li>
                        <xsl:call-template name="referenceIssues">
                            <xsl:with-param name="issueStatus">externalComments</xsl:with-param>
                            <xsl:with-param name="issueList" select="$externalComments"/>
                            <xsl:with-param name="issueDesc">Comments from reviewers who are not
                                participating in the Working Group.</xsl:with-param>
                        </xsl:call-template>
                    </li>
                </ul>
                <h3>1.3 Non-editorial Changes in the Draft</h3>
                <xsl:call-template name="referenceIssues">
                    <xsl:with-param name="issueStatus">nonEditorialChange</xsl:with-param>
                    <xsl:with-param name="issueList" select="$nonEditorialChange"/>
                    <xsl:with-param name="issueDesc">To implement the comment, the Working Group
                        made a non-editorial change to the specification. Nevertheless, the Working
                        Group believes that the change does not invalidate previous reviews of the
                        draft or implementation experiences, since no new concept was introduced,
                        and no existing concept was modified.</xsl:with-param>
                </xsl:call-template>
                <h2>2. Detailed Description of Comments</h2>
                <xsl:apply-templates select="//bug">
                    <xsl:sort select="bug_id"/>
                </xsl:apply-templates>
            </body>
        </html>
    </xsl:template>

    <xsl:template match="bug">
        <table class="issue" id="{concat('issue-',bug_id)}" width="100%"
            xmlns="http://www.w3.org/1999/xhtml">
            <tr>
                <td>
                    <b>
                        <xsl:value-of select="bug_id"/>
                    </b>
                    <xsl:text>: </xsl:text>
                    <a
                        href="{concat('http://www.w3.org/Bugs/Public/show_bug.cgi?id=',bug_id,'#c0')}">
                        <xsl:value-of select="short_desc"/>
                    </a>
                </td>
            </tr>
            <tr>
                <td>First recorded: <xsl:value-of select="substring-before(creation_ts,' ')"/></td>
            </tr>
            <tr>
                <td>Last modified: <xsl:value-of
                        select="substring-before(.//long_desc[last()]/bug_when,' ')"/></td>
            </tr>
            <tr>
                <td>
                    <xsl:text>Last modification: </xsl:text>
                    <xsl:value-of select=".//long_desc[last()]/thetext"/>
                </td>
            </tr>
            <tr>
                <td>Review Status: <xsl:call-template name="resolution"/></td>
            </tr>
        </table>
        <hr xmlns="http://www.w3.org/1999/xhtml"/>
    </xsl:template>

    <xsl:template name="resolution">
        <xsl:if test="exists($wgRejectsComment intersect .)">
            <span class="changeDeclined" xmlns="http://www.w3.org/1999/xhtml">Change declined.</span>
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="exists($noResponse intersect .)">
            <span class="noResponse" xmlns="http://www.w3.org/1999/xhtml">No response from reviewer.</span>
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="exists($wgAcceptsComment intersect .)">
            <span class="proposalAccepted" xmlns="http://www.w3.org/1999/xhtml">Working Group
                accepted proposal.</span>
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="exists($reviewerNotSatisfied intersect .)">
            <span class="reviewerNotSatisfied" xmlns="http://www.w3.org/1999/xhtml">Reviewer is not
                satisfied.</span>
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="exists($reviewerSatisfied intersect .)">
            <span class="reviewerSatisfied" xmlns="http://www.w3.org/1999/xhtml">Reviewer is
                satisfied.</span>
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="exists($nonEditorialChange intersect .)">
            <span xmlns="http://www.w3.org/1999/xhtml">
                <b>Non-editorial change.</b>
            </span>
            <xsl:text> </xsl:text>
        </xsl:if>
        <xsl:if test="exists($externalComments intersect .)">
            <span xmlns="http://www.w3.org/1999/xhtml">
                <b>Working Group External Comment.</b>
            </span>
            <xsl:text> </xsl:text>
        </xsl:if>
    </xsl:template>
</xsl:transform>