如何获得YQL的格式化视图? [英] How to get the formatted view of YQL as result?

查看:102
本文介绍了如何获得YQL的格式化视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YQL仅在树形视图中给出结果.有什么办法可以在格式化视图中获得结果?

YQL gives out result only in tree view. Is there any way to get the result in Formatted view??

推荐答案

使用XSLT样式表创建带格式的视图.这是RSS供稿的示例:

Use an XSLT stylesheet to create a formatted view. Here is an example for an RSS feed:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="XML" encoding="utf-8"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
indent="yes"/>

<xsl:template match='//channel'>
<page>
<content>
<module>
<header layout="simple">
<layout-items>
<block class="title">YDN Widget</block>
</layout-items>
</header>
</module>
<xsl:apply-templates select="item" />
</content>
</page>
</xsl:template>

<xsl:template match="item">
<placard layout="card" class="link">
<layout-items>
<image resource="ybang"/>
<block class="title"><xsl:value-of select="title"/></block>
<block class="description"><xsl:value-of select="pubDate"/></block>
<block class="subtext"><xsl:value-of select="category"/></block>
</layout-items>
<load resource="{link}" event="activate"/>
</placard>
</xsl:template>
</xsl:stylesheet>

使用以下YQL语法进行引用:

Referenced using the following YQL syntax:

select * from xslt where url="//foo.rss" and stylesheet="//bar.xsl"

这篇关于如何获得YQL的格式化视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆