<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE stylesheet SYSTEM "/native/fx/opinions.dtd">

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <xsl:param name="searchURL" select="'http://blogs.yandex.ru/search.xml?text='"/>

    <xsl:output method="xml" encoding="UTF-8" indent="no"/>

    <xsl:template match="page">
        <vbox flex="1">
            <xsl:choose>
                <xsl:when test="number(@count) &gt; 0">
                    <yaclickscrollbox id="opinions-content-scroll" orient="vertical" flex="1">
                        <xsl:apply-templates select="user"/>
                    </yaclickscrollbox>
                    <hbox id="opinions-getmore-link" pack="center">
                        <label value="&opinions.link.openCommnets.label.small;" yaLinkAction="3300">
                            <xsl:attribute name="yahref">
                                <xsl:value-of select="$searchURL"/>
                            </xsl:attribute>
                        </label>
                    </hbox>
                </xsl:when>
                <xsl:otherwise>
                    <vbox flex="1" align="center" valign="middle">
                        <label value="&opinions.request.notfound;"/>
                    </vbox>
                </xsl:otherwise>
            </xsl:choose>
        </vbox>
    </xsl:template>

    <xsl:template match="user">
        <hbox class="opinion-hbox" tooltip="opinions-window-tooltip">
            <xsl:attribute name="yahref">
                <xsl:value-of select="url"/>
            </xsl:attribute>

            <vbox>
                <hbox pack="center">
                    <xsl:apply-templates select="img"/>
                </hbox>
            </vbox>
            <vbox class="ya-blogger-text" flex="1">
                <hbox>
                    <label flex="1" crop="end" class="ya-blogger-user">
                        <xsl:attribute name="value">
                            <xsl:value-of select="username"/>
                        </xsl:attribute>
                    </label>
                    <spacer/>
                    <label crop="end" class="ya-blogger-time">
                        <xsl:attribute name="value">
                            <xsl:value-of select="date"/>
                        </xsl:attribute>
                    </label>
                </hbox>
                <description>
                    <xsl:value-of select="subject"/>
                </description>
                <description class="ya-blogger-snipp">
                    <xsl:value-of select="snippet"/>
                </description>
            </vbox>
        </hbox>
    </xsl:template>

    <xsl:template match="img">
        <image align="center" valign="top">
            <xsl:attribute name="src">
                <xsl:value-of select="@src"/>
            </xsl:attribute>
            <xsl:attribute name="width">
                <xsl:value-of select="@width"/>
            </xsl:attribute>
            <xsl:attribute name="height">
                <xsl:value-of select="@height"/>
            </xsl:attribute>
        </image>
    </xsl:template>

</xsl:stylesheet>
