xml中实现HTML的自动换行,该如何解决
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 "> 	 </xsl:text>
<xsl:if test= "position() mod 5 = 1 ">
<xsl:text disable-output-escaping= "yes "> </xsl:text>
</xsl:if>
</xsl:if>
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 "> 	 </xsl:text>
<xsl:if test= "position() mod 5 = 1 ">
<xsl:text disable-output-escaping= "yes "> </xsl:text>
</xsl:if>
</xsl:if>