<!--                                                                  -->
<!--  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="section" id="auditReport">
    	    <xsl:choose>
    		    <xsl:when test="Report/Publisher">
    			    <div class="reportNavWrapper">
    				    <h2>
    					    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:call-template name="reportHeading" />
	    			    <xsl:call-template name="reportNav" />
					</div>
		  		    <xsl:call-template name="publisherMailingTable" />
		  		    <xsl:call-template name="reportNav" />
					<br class="superBreak" />
					<br />
				</xsl:when>
				<xsl:otherwise>
					<p>No publishers were found.</p>
				</xsl:otherwise>
			</xsl:choose>
		</div>		
		<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>	
	</xsl:template>


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


</xsl:stylesheet>
