2010-04-06 61 views
1

YQL仅在树视图中给出结果。有什么方法可以在Formatted视图中获取结果?如何获得YQL的格式化视图作为结果?

+0

什么,“格式化”你想的看法是? – salathe 2010-04-07 08:22:53

+0

我想以HTML格式查看... 那么,我可以使用雅虎管道获取模块来获取HTML页面,但获取模块可以获取小于200K的页面。但YQL可以获取超过200K的页面。因此,我想使用YQL,但我需要HTML格式的抓取页面 – 2010-04-08 11:30:26

回答

2

使用XSLT样式表来创建一个格式化的视图。下面是一个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语法参考:

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