Xml 从youtube api XSLT获取大量视图

Xml 从youtube api XSLT获取大量视图,xml,api,xslt,youtube,youtube-api,Xml,Api,Xslt,Youtube,Youtube Api,我正在尝试从youtube api中获取大量的浏览量,它对标题、url和缩略图都很有效,尽管它对浏览量没有影响 这是我试图获取的XML代码(请看最后一行): http://gdata.youtube.com/feeds/api/standardfeeds/on_the_web 2012-03-21T03:32:37.000-07:00 网上 http://www.youtube.com/img/pic_youtubelogo_123x63.gif YouTube http://www.yout

我正在尝试从youtube api中获取大量的浏览量,它对标题、url和缩略图都很有效,尽管它对浏览量没有影响

这是我试图获取的XML代码(请看最后一行):


http://gdata.youtube.com/feeds/api/standardfeeds/on_the_web
2012-03-21T03:32:37.000-07:00
网上
http://www.youtube.com/img/pic_youtubelogo_123x63.gif
YouTube
http://www.youtube.com/
YouTube数据API
192
1.
25
http://gdata.youtube.com/feeds/api/videos/LSNxrEa3Usw
2012-03-07T01:09:29.000Z
2012-03-21T10:32:34.000Z
2岁的马克娜唱阿黛尔…太可爱了
我2岁的女儿喜欢阿黛尔,她也跟着唱!
石南花
http://gdata.youtube.com/feeds/api/users/heatherfedorick
游戏娱乐
我2岁的女儿喜欢阿黛尔,她也跟着唱!
马克娜,阿黛尔,唱歌
判定元件
2岁的马克娜唱阿黛尔…太可爱了
这是获取数据并将其放入自己定义的xml格式的代码:

<?xml version="1.0" ?>

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://www.w3.org/2005/Atom"
xmlns:media='http://search.yahoo.com/mrss/'>
xmlns:yt='http://gdata.youtube.com/schemas/2007'

<xsl:template match="/">

<xsl:for-each select="/a:feed/a:entry">
<item>
    <xsl:attribute name="type">youtube</xsl:attribute>

    <xsl:attribute name="name">
        <xsl:value-of select="a:title" />
    </xsl:attribute>

    <xsl:attribute name="author">
        <xsl:value-of select="a:author/a:name" />
    </xsl:attribute>

    <xsl:attribute name="url">
        <xsl:value-of select="a:link/@href" />
    </xsl:attribute>

    <xsl:attribute name="image">
        <xsl:value-of select="media:group/media:thumbnail[@width='120']/@url" />
    </xsl:attribute>

    <xsl:attribute name="score">
        <xsl:value-of select="yt:statistics/@viewCount" />
    </xsl:attribute>
</item>
</xsl:for-each>

</xsl:template>

xmlns:yt=http://gdata.youtube.com/schemas/2007'
youtube
尽管这句话:

<xsl:attribute name="score">
    <xsl:value-of select="yt:statistics/@viewCount" />
</xsl:attribute>

根本不会返回我的分数:(


知道我做错了什么吗?

您发布的样式表格式不正确,尤其是在

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://www.w3.org/2005/Atom"
xmlns:media='http://search.yahoo.com/mrss/'>
xmlns:yt='http://gdata.youtube.com/schemas/2007'

xmlns:yt=http://gdata.youtube.com/schemas/2007'
是放错地方了,需要

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://www.w3.org/2005/Atom"
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:yt='http://gdata.youtube.com/schemas/2007'>


据我所知,这是错误的。但是,我希望任何XSLT处理者都会报告该错误,因此在您的实际代码中可能存在其他或进一步的问题。如果您仍然存在问题,请发布最小但完整的示例,使我们能够重现该问题,包括您收到的任何错误消息以及的名称和版本你的XSLT处理器。

哇,我真是太蠢了:p谢谢!你不知道我找了多久了:p
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://www.w3.org/2005/Atom"
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:yt='http://gdata.youtube.com/schemas/2007'>