home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0"?>
- <!DOCTYPE stylesheet SYSTEM "chrome://yasearch/locale/dialogs/welcome.dtd">
-
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:html="http://www.w3.org/1999/xhtml"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- >
-
- <xsl:output method="xml" encoding="UTF-8" indent="no"/>
-
- <xsl:param name="localeTld" select="'ru'"/>
- <xsl:param name="defaultLocaleTld" select="'ru'"/>
- <xsl:param name="maxRows" select="3"/>
-
- <xsl:template match="services">
- <vbox flex="1">
- <grid flex="1">
- <columns>
- <column flex="1"/>
- <column flex="1"/>
- </columns>
- <rows>
- <xsl:call-template name="services">
- <xsl:with-param name="serviceNodes" select="service"/>
- </xsl:call-template>
- </rows>
- </grid>
-
- <hbox id="all-services-box">
- <label value="&yasearch.services.iuse.all.label;" yaLinkAction="3800">
- <xsl:if test="boolean(count(service[@error='0']) > $maxRows * 2)">
- <xsl:attribute name="yahref">
- <xsl:text>http://i.yandex.ru/</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </label>
- </hbox>
- </vbox>
- </xsl:template>
-
- <xsl:template name="services">
- <xsl:param name="serviceNodes"/>
-
- <xsl:for-each select="$serviceNodes[position()-1 < $maxRows]">
- <xsl:variable name="position" select="(position()) + $maxRows"/>
- <row>
- <hbox><xsl:apply-templates select="."/></hbox>
- <hbox><xsl:apply-templates select="$serviceNodes[position() = $position]"/></hbox>
- </row>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="service">
- <hbox class="service-data" yaserviceerror="{@error}">
- <hbox class="service-icon">
- <vbox><xsl:apply-templates select="./icon" mode="lang"/></vbox>
- </hbox>
- <xsl:apply-templates select="./iuse" mode="lang"/>
- <hbox class="service-counter-data" yaIsCounter="{@counter}" flex="1">
- <xsl:apply-templates select=".[@counter='yes' and @error='0']/@v[number(.) >= 0]"/>
- </hbox>
- </hbox>
- </xsl:template>
-
- <!-- filter by @lang -->
- <xsl:template match="service/*" mode="lang">
- <xsl:variable name="nodeName" select="name()"/>
-
- <xsl:variable name="nodeEmptyLang"
- select="../*[not(@lang) and name()=$nodeName]"/>
-
- <xsl:variable name="nodeWithLang"
- select="../*[@lang = $localeTld and name()=$nodeName]"/>
- <xsl:choose>
- <xsl:when test="(@lang = $localeTld)
- or (not(@lang) and not($nodeWithLang))
- or (@lang = $defaultLocaleTld and not($nodeWithLang) and not($nodeEmptyLang))">
- <xsl:apply-templates select="."/>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="service/*/@*" mode="lang">
- <xsl:variable name="nodeName" select="name(parent::*)"/>
-
- <xsl:variable name="nodeWithLang"
- select="../../*[@lang = $localeTld and name()=$nodeName]"/>
-
- <xsl:choose>
- <xsl:when test="(../@lang = $localeTld)
- or (not(../@lang) and not($nodeWithLang))">
- <xsl:apply-templates select="."/>
- </xsl:when>
- <xsl:otherwise/>
- </xsl:choose>
- </xsl:template>
- <!-- /filter by @lang-->
-
- <xsl:template match="icon">
- <image src="{.}"/>
- </xsl:template>
-
- <xsl:template match="iuse">
- <label crop="end" value="{.}">
- <xsl:if test="string(../url) != ''">
- <xsl:attribute name="yahref">
- <xsl:apply-templates select="../url" mode="lang"/>
- </xsl:attribute>
- <xsl:attribute name="yaLinkAction">
- <xsl:apply-templates select="../url/@action" mode="lang"/>
- </xsl:attribute>
- </xsl:if>
- </label>
- </xsl:template>
-
- <xsl:template match="url | counterurl">
- <xsl:value-of select="."/>
- </xsl:template>
-
- <xsl:template match="@v[number(.) > 0]">
- <hbox class="full-counter yaoverfl" flex="1" value="{.}">
- <xsl:attribute name="yahref">
- <xsl:apply-templates select="../counterurl" mode="lang"/>
- </xsl:attribute>
- <xsl:attribute name="yaLinkAction">
- <xsl:apply-templates select="../counterurl/@action" mode="lang"/>
- </xsl:attribute>
- </hbox>
- </xsl:template>
-
- <xsl:template match="@v"/>
-
- </xsl:stylesheet>