Warning, /multimedia/kmplayer/data/youtube.xsl is written in an unsupported language. File is not indexed.

0001 <?xml version="1.0" encoding="ISO-8859-1"?>
0002 
0003 <xsl:stylesheet version="1.0"
0004   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
0005   xmlns:n1="http://www.w3.org/2005/Atom"
0006   xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
0007   xmlns:gml="http://www.opengis.net/gml"
0008   xmlns:georss="http://www.georss.org/georss"
0009   xmlns:media="http://search.yahoo.com/mrss/"
0010   xmlns:batch="http://schemas.google.com/gdata/batch"
0011   xmlns:yt="http://gdata.youtube.com/schemas/2007"
0012   xmlns:gd="http://schemas.google.com/g/2005">
0013 
0014   <xsl:template match="/">
0015     <playlist>
0016       <xsl:for-each select="n1:feed/n1:entry">
0017         <xsl:variable name="ratings">
0018           <xsl:apply-templates select="gd:rating"/>
0019         </xsl:variable>
0020         <group title="{normalize-space(n1:title)}">
0021           <xsl:apply-templates select="media:group">
0022             <xsl:with-param name="ratings">
0023               <xsl:copy-of select="$ratings"/>
0024             </xsl:with-param>
0025           </xsl:apply-templates>
0026         </group>
0027       </xsl:for-each>
0028     </playlist>
0029   </xsl:template>
0030 
0031   <xsl:template match="node()">
0032   </xsl:template>
0033 
0034   <xsl:template match="media:group">
0035     <xsl:param name="ratings"/>
0036     <xsl:variable name="item_title">
0037       <xsl:choose>
0038         <xsl:when test="media:title">
0039           <xsl:value-of select="normalize-space(media:title)"/>
0040         </xsl:when>
0041         <xsl:otherwise>Overview</xsl:otherwise>
0042       </xsl:choose>
0043     </xsl:variable>
0044     <xsl:variable name="item_url">
0045       <xsl:apply-templates select="media:player"/>
0046     </xsl:variable>
0047     <item title="{$item_title}">
0048       <smil>
0049         <head>
0050           <layout>
0051             <root-layout width="400" height="300" background-color="#F5F5DC"/>
0052             <region id="title" left="10" top="10" height="18" right="10"/>
0053             <region id="image" left="5" top="40" width="130" bottom="30"/>
0054             <region id="rating" left="15" width="100" height="20" bottom="5"/>
0055             <region id="text" left="140" top="40" bottom="10" right="10" fit="scroll"/>
0056           </layout>
0057           <transition id="fade" dur="0.3" type="fade"/>
0058         </head>
0059         <body>
0060           <par>
0061             <seq repeatCount="indefinite">
0062               <xsl:apply-templates select="media:thumbnail"/>
0063             </seq>
0064             <a href="{$item_url}" target="top">
0065               <smilText region="title" textFontWeight="bold" textColor="blue" textFontSize="11" textAlign="center">
0066                 <xsl:value-of select="$item_title"/>
0067               </smilText>
0068             </a>
0069             <xsl:copy-of select="$ratings"/>
0070             <smilText region="text" textFontFamily="serif" textFontSize="11">
0071               <xsl:value-of select="media:description"/>
0072             </smilText>
0073           </par>
0074         </body>
0075       </smil>
0076     </item>
0077     <xsl:apply-templates select="media:content"/>
0078   </xsl:template>
0079 
0080   <xsl:template match="media:thumbnail">
0081     <img region="image" src="{@url}" dur="20" transIn="fade" fill="transition" fit="meet"/>
0082   </xsl:template>
0083 
0084   <xsl:template match="media:content">
0085     <item url="{@url}"/>
0086   </xsl:template>
0087 
0088   <xsl:template match="media:player">
0089     <xsl:value-of select="@url"/>
0090   </xsl:template>
0091 
0092   <xsl:template name="svg_star">
0093     <xsl:param name="avg"/>
0094     <xsl:param name="nr"/>
0095     <xsl:variable name="x_pos">
0096       <xsl:value-of select="10 + 40 * $nr"/>
0097     </xsl:variable>
0098     <xsl:variable name="fill">
0099       <xsl:choose>
0100         <xsl:when test="$avg > $nr">#ff0000</xsl:when>
0101         <xsl:otherwise>#C0C0C0</xsl:otherwise>
0102       </xsl:choose>
0103     </xsl:variable>
0104     <path style="stroke:#A0A0A0;stroke-width:2px;stroke-opacity:1;fill:{$fill};" d="M 21.429,23.571 L 10.850,18.213 L 0.439,23.890 L 2.266,12.173 L -6.351,4.026 L 5.357,2.143 L 10.443,-8.569 L 15.852,1.984 L 27.612,3.510 L 19.247,11.916 L 21.429,23.571 z" transform="translate({$x_pos},11)"/>
0105   </xsl:template>
0106 
0107   <xsl:template match="gd:rating">
0108     <xsl:variable name="avg">
0109       <xsl:value-of select="floor(@average) mod 6"/>
0110     </xsl:variable>
0111     <img region="rating">
0112       <svg width="200" height="40">
0113         <xsl:call-template name="svg_star">
0114           <xsl:with-param name="avg">
0115             <xsl:value-of select="$avg"/>
0116           </xsl:with-param>
0117           <xsl:with-param name="nr">0</xsl:with-param>
0118         </xsl:call-template>
0119         <xsl:call-template name="svg_star">
0120           <xsl:with-param name="avg">
0121             <xsl:value-of select="$avg"/>
0122           </xsl:with-param>
0123           <xsl:with-param name="nr">1</xsl:with-param>
0124         </xsl:call-template>
0125         <xsl:call-template name="svg_star">
0126           <xsl:with-param name="avg">
0127             <xsl:value-of select="$avg"/>
0128           </xsl:with-param>
0129           <xsl:with-param name="nr">2</xsl:with-param>
0130         </xsl:call-template>
0131         <xsl:call-template name="svg_star">
0132           <xsl:with-param name="avg">
0133             <xsl:value-of select="$avg"/>
0134           </xsl:with-param>
0135           <xsl:with-param name="nr">3</xsl:with-param>
0136         </xsl:call-template>
0137         <xsl:call-template name="svg_star">
0138           <xsl:with-param name="avg">
0139             <xsl:value-of select="$avg"/>
0140           </xsl:with-param>
0141           <xsl:with-param name="nr">4</xsl:with-param>
0142         </xsl:call-template>
0143       </svg>
0144     </img>
0145   </xsl:template>
0146 
0147 </xsl:stylesheet>