<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE doc [
	<!ENTITY nbsp "&#160;">
]>

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="PhoneDogResponse">
		<style type="text/css">
			h1 {font-size:22px;padding-top:0px;margin-top:0px;margin-bottom:8px;}
			h2 {font-size:18px;}
			h3 {font-size:16px;color:#44870E;margin-bottom:2px;}
			.output-header {background-color:#eee;border:solid 1px #ccc;padding:10px;margin-bottom:20px;}
			.output-arguments {}
			.output-paging {border-top:dotted 1px #ccc;margin-top:10px;padding-top:10px;}
			.item {border-bottom:solid 1px #ccc;margin-bottom:20px;padding-bottom:20px;}
			.item-header {border-bottom:dotted 1px #ccc;padding:6px;padding-bottom:10px;margin-bottom:20px;background-color:#E0ECFF;}
			.item-header img {border:solid 1px #000;float:left;margin-right:10px;}
			.item-player {margin-bottom:10px;}
			.item-body {}
			.item-tags {margin-top:6px;}
		</style>
		
		<xsl:apply-templates select="Errors"/>
		<xsl:apply-templates select="ContentItems"/>
	</xsl:template>

	<xsl:template match="Errors">
		<xsl:value-of select="Error"/>
		<br/>
	</xsl:template>

	<xsl:template match="ContentItems">
		<div class="output-header">
			<h1>PhoneDogResponse : Arguments</h1>
			<div class="output-arguments">
				<xsl:for-each select="//Request/Arguments/Attribute">
					<b><xsl:value-of select="@Name"/></b> : <xsl:value-of select="@Value"/><br/>
				</xsl:for-each>
			</div>
			<xsl:if test="@TotalPages > 1">
				<div class="output-paging">
					<b>Total pages: </b> <xsl:value-of select="@TotalPages"/><br/>
					<b>Total records: </b>
					<xsl:value-of select="@TotalRecords"/>
				</div>
			</xsl:if>
		</div>
		<xsl:apply-templates select="ContentItem "/>		
	</xsl:template>

	<xsl:template match="ContentItem ">
		<div class="item">
			<div class="item-header">
				<img>
					<xsl:attribute name="src"><xsl:value-of select="ImageSmall/@Url"/></xsl:attribute>
					<xsl:attribute name="width"><xsl:value-of select="ImageSmall/@Width"/></xsl:attribute>
					<xsl:attribute name="height"><xsl:value-of select="ImageSmall/@Height"/></xsl:attribute>
				</img>				
				<h1>
					<xsl:value-of select="Name"/>
				</h1>
				Published on: <xsl:value-of select="PublishDate"/> (<xsl:value-of select="TotalViews"/> views)<br/>
				Author: 
				<a>
					<xsl:attribute name="href"><xsl:value-of select="Author/UrlProfile"/></xsl:attribute>
					<xsl:value-of select="Author/Name"/>
				</a>
			</div>
			<xsl:if test="YouTubeId != ''">
				<div class="item-player">
					<object width="630" height="376"> 
						<param>
							<xsl:attribute name="movie">http://www.youtube.com/v/<xsl:value-of select="YouTubeId"/>&amp;rel=0&amp;autoplay=0&amp;fs=1</xsl:attribute>
						</param>
						<param name="allowFullScreen" value="true"></param> 
						<param name="wmode" value="transparent"/>
						<embed allowfullscreen="true" type="application/x-shockwave-flash" wmode="transparent" width="630" height="376">
							<xsl:attribute name="src">http://www.youtube.com/v/<xsl:value-of select="YouTubeId"/>&amp;rel=0&amp;autoplay=0&amp;fs=1</xsl:attribute>
						</embed>
					</object> 				
				</div>
			</xsl:if>
			<div class="item-body">
				<xsl:value-of select="Content" disable-output-escaping="yes"/>				
			</div>
			
			<xsl:if test="count(Related/Tags/Tag) &gt; 0">
				<div class="item-tags">
					<b>Tags:</b> <xsl:text> </xsl:text>
					<xsl:apply-templates select="Related/Tags"/>
				</div>
			</xsl:if>
			
			<xsl:if test="count(Related/Phones/Phone) &gt; 0">
				<div class="item-tags">
					<b>Phones:</b> <xsl:text> </xsl:text>
					<xsl:apply-templates select="Related/Phones"/>
				</div>
			</xsl:if>
			
			<xsl:if test="count(Related/Companies/Company) &gt; 0">
				<div class="item-tags">
					<b>Companies:</b> <xsl:text> </xsl:text>
					<xsl:apply-templates select="Related/Companies"/>
				</div>
			</xsl:if>			
		</div>
	</xsl:template>

	<xsl:template match="Related/Tags">
		<a>
			<xsl:attribute name="href"><xsl:value-of select="Tag/@UrlDetails"/></xsl:attribute>
			<xsl:value-of select="Tag"/>
		</a>
	</xsl:template>

	<xsl:template match="Related/Companies">
		<a>
			<xsl:attribute name="href"><xsl:value-of select="Company/@UrlDetails"/></xsl:attribute>
			<xsl:value-of select="Company"/>
		</a>
	</xsl:template>
	
	<xsl:template match="Related/Phones">
		<a>
			<xsl:attribute name="href"><xsl:value-of select="Phone/@UrlDetails"/></xsl:attribute>
			<xsl:value-of select="Phone"/>
		</a>
	</xsl:template>	
</xsl:stylesheet> 

