<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


    <xsl:template name="publisherMailingLayout">
        <div class="AuditReport" id="auditReport">
            <h2 class="AuditReport-header">
                Publisher Mailing List
                <xsl:call-template name="helpIcon">
                    <xsl:with-param name="tip">
                        Provides address information for publishers associated with a specific royalty run
                    </xsl:with-param>
                </xsl:call-template>
            </h2>
            <xsl:choose>
                <xsl:when test="Report/Publisher">

                    <xsl:call-template name="reportHeading" />
                    <xsl:call-template name="publisherMailingTable" />
                    <xsl:call-template name="reportFooter" />

                </xsl:when>
                <xsl:otherwise>
                    <section class="Table-empty-results">
                        <p>No publishers were found.</p>
                    </section>
                </xsl:otherwise>
            </xsl:choose>

            <xsl:choose>
                <xsl:when test="$cmd = 'ca_publisher_mailing'">
                    <xsl:call-template name="backToCAMechRun" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:call-template name="backToMechRun" />
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>


    <xsl:template name="publisherMailingTable">
        <table class="Table Table-with-highlight">
            <thead>
                <tr class="Table-row Table-row-header">
                    <th class="Table-col">Publisher</th>
                    <th class="Table-col">Address 1</th>
                    <th class="Table-col">Address 2</th>
                    <th class="Table-col">Address 3</th>
                    <th class="Table-col">City</th>
                    <th class="Table-col">State/Province</th>
                    <th class="Table-col">Zip/Postal</th>
                    <th class="Table-col">Country</th>
                    <th class="Table-col">Client&#160;#</th>
                </tr>
            </thead>
            <tbody>
                <xsl:for-each select="Report/Publisher">
                    <tr class="Table-row Table-row-data">
                        <td class="Table-col">
                            <a href="{$publisherArea}?c=show&amp;PublisherID={PublisherID}"><xsl:value-of select="PublisherName" /></a>
                        </td>
                        <td class="Table-col"><xsl:value-of select="StreetAddress" /></td>
                        <td class="Table-col"><xsl:value-of select="StreetAddress2" /></td>
                        <td class="Table-col"><xsl:value-of select="StreetAddress3" /></td>
                        <td class="Table-col"><xsl:value-of select="City" /></td>
                        <td class="Table-col"><xsl:value-of select="StateProvince" /></td>
                        <td class="Table-col"><xsl:value-of select="PostalCode" /></td>
                        <xsl:variable name="countryCode" select="CountryCode" />
                        <td class="Table-col"><xsl:value-of select="/Root/Report/CountryList/Country[CountryCode = $countryCode]/Name" /></td>
                        <td class="Table-col"><xsl:value-of select="ClientAccountID" /></td>
                    </tr>
                </xsl:for-each>
            </tbody>
        </table>
    </xsl:template>


</xsl:stylesheet>
