YQL gives out result only in tree view. Is there any way to get the result in Formatted view??
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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>
Referenced using the following YQL syntax:
select * from xslt where url="//foo.rss" and stylesheet="//bar.xsl"