XSL中實現HTML的表格自動換行_Xml教程
推薦:如何利用XMLHTTP無刷新獲取數據利用XMLHTTP無刷新獲取數據. 客戶端和服務器端數據的交互有幾種方法. 1.提交,通過form/form提交到服務器端.也稱有刷新吧. 2.通過XMLHTTP無刷新提交到服務器端,并返回數據.也稱無刷新吧. 利用XMLHTTP我們可以實現很多很強大的應用.這文章主要介紹它的一
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
XSL代碼:
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="Rows">5</xsl:variable>
<xsl:template match="//root">
<table>
<xsl:for-each select="movie[position() mod Rows=1]">
<tr>
<xsl:apply-templates select=".|following-sibling::*[position()<Rows]"/>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="movie">
<td>
<xsl:value-of select="."/>
</td>
</xsl:template>
</xsl:stylesheet>
分享:利用XMLHTTP無刷新自動實時更新數據前些時間寫了幾篇關于XMLHTTP運用的實例. (可以到http://dev.csdn.net/user/wanghr100看之前的幾編關于XMLHTTP的介紹.) 近來看論壇上經常有人提問關于如何無刷新,自動更新數據. 傳統上,我們瀏覽網頁,如果加入最新的數據.只能是等我們重新向服務器端請求時才
- 相關鏈接:
- 教程說明:
Xml教程-XSL中實現HTML的表格自動換行。