首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

xml中实现HTML的自动换行,该如何解决

2012-03-07 
xml中实现HTML的自动换行xml数据如:rootmovie 1 /moviemovie 2 /moviemovie 3 /moviemovie

xml中实现HTML的自动换行
xml数据如:
<root>
<movie> 1 </movie>
<movie> 2 </movie>
<movie> 3 </movie>
<movie> 4 </movie>
<movie> 5 </movie>
<movie> 6 </movie>
<movie> 7 </movie>
<movie> 8 </movie>
<movie> 9 </movie>
<movie> 10 </movie>
<movie> 11 </movie>
<movie> 12 </movie>
</root>

要达到的效果:
1           2           3           4             5
6           7           8           9           10
11     12

请问在html用数据岛的方式,可以弄吗?


[解决办法]
用xslt格式化
<table>
<xsl:for-each select= "* ">
<xsl:if test= "position() mod 5 = 1 ">
<xsl:text disable-output-escaping= "yes "> <![CDATA[ </tr> <tr> ]]> </xsl:text>
</xsl:if>
<td> 内容 </td>
</xsl:for-each>
</table>
[解决办法]
<xsl:if test= "position() != 1 ">
<xsl:text disable-output-escaping= "yes "> &#9; </xsl:text>
<xsl:if test= "position() mod 5 = 1 ">
<xsl:text disable-output-escaping= "yes "> &#10; </xsl:text>
</xsl:if>
</xsl:if>

热点排行