如何获取YQL的格式化视图?

时间:2010-04-06 22:14:56

标签: pipe concatenation yql

YQL仅在树视图中给出结果。有没有办法在Formatted视图中获得结果??

1 个答案:

答案 0 :(得分:2)

使用XSLT样式表创建格式化视图。以下是RSS提要的示例:

<?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语法引用:

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