XSLT 教程
XSL 指擴展樣式表語言(EXtensible Stylesheet Language), 它是一個XML 文檔的樣式表語言。
XSLT 指XSL 轉換。 在此教程中,你將學習如何使用XSLT 將XML 文檔轉換為其他文檔,比如XHTML。
現在開始學習XSLT !
XSLT 實例
XSLT 實例
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<xsl:for-each select="catalog/cd">
<tr>
<td><xsl:value-of select="title"/></td>
<td><xsl:value-of select="artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
嘗試一下»
XSLT 參考手冊
XSLT元素
對所有來自W3C 標準的XSLT 元素進行了描述,以及關於瀏覽器支持的信息。
XSLT函數
XSLT 包含了超過100 個內置函數。 這些函數可以用於字符串、數值、日期和時間比較、節點和QName 處理, 序列處理, 邏輯值等等。