亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
XSLT 基礎(chǔ)教程 XSL 語(yǔ)言 XSLT 簡(jiǎn)介 XSLT 瀏覽器 XSLT - 轉(zhuǎn)換 XSLT <xsl:template> 元素 XSLT <xsl:value-of> 元素 XSLT <xsl:for-each> 元素 XSLT <xsl:sort> 元素 XSLT <xsl:if> 元素 XSLT <xsl:choose> 元素 XSLT <xsl:apply-templates> 元素 XSLT - 在客戶端 XSLT - 在服務(wù)器端 XSLT - 編輯 XML XML 編輯器 XSLT 元素參考手冊(cè) XSLT <xsl:apply-imports> 元素 XSLT <xsl:apply-templates> 元素 XSLT <xsl:attribute> 元素 XSLT <xsl:attribute-set> 元素 XSLT <xsl:call-template> 元素 XSLT <xsl:choose> 元素 XSLT <xsl:comment> 元素 XSLT <xsl:copy> 元素 XSLT <xsl:copy-of> 元素 XSLT <xsl:decimal-format> 元素 XSLT <xsl:element> 元素 XSLT <xsl:fallback> 元素 XSLT <xsl:for-each> 元素 XSLT <xsl:if> 元素 XSLT <xsl:import> 元素 XSLT <xsl:include> 元素 XSLT <xsl:key> 元素 XSLT <xsl:message> 元素 XSLT <xsl:namespace-alias> 元素 XSLT <xsl:number> 元素 XSLT <xsl:otherwise> 元素 XSLT <xsl:output> 元素 XSLT <xsl:param> 元素 XSLT <xsl:preserve-space> 和 <xsl:strip-space> 元素 XSLT <xsl:processing-instruction> 元素 XSLT <xsl:sort> 元素 XSLT <xsl:stylesheet> 和 <xsl:transform> 元素 XSLT <xsl:template> 元素 XSLT <xsl:text> 元素 XSLT <xsl:value-of> 元素 XSLT <xsl:value-of> 元素 XSLT <xsl:variable> 元素 XSLT <xsl:when> 元素 XSLT <xsl:with-param> 元素 XSLT 函數(shù) XSLT current() 函數(shù) XSLT document() 函數(shù) XSLT element-available() 函數(shù) XSLT format-number() 函數(shù) XSLT function-available() 函數(shù) XSLT generate-id() 函數(shù) XSLT key() 函數(shù) XSLT system-property() 函數(shù) XSLT unparsed-entity-uri() 函數(shù)
characters

XSLT <xsl:template> 元素



定義和用法

<xsl:template> 元素包含了當(dāng)匹配指定節(jié)點(diǎn)時(shí)要應(yīng)用的規(guī)則。

match 屬性用于把模板關(guān)聯(lián)到某個(gè) XML 元素。match 屬性也能用于為 XML 文檔的全部分支定義模板(比如,match="/" 定義了整個(gè)文檔)。

注意:<xsl:template> 是頂層元素(top-level element)。


語(yǔ)法

<xsl:template
name="name"
match="pattern"
mode="mode"
priority="number">
<!-- Content:(<xsl:param>*,template) -->
</xsl:template>

屬性

屬性描述
namename可選。為模板定義名稱(chēng)。

注釋?zhuān)?/strong>如果省略該屬性,則必須設(shè)置 match 屬性。

matchpattern可選。模板的匹配模式。

注釋?zhuān)?/strong>如果省略該屬性,則必須設(shè)置 name 屬性。

modemode可選。為模板規(guī)定模式。
prioritynumber可選。一個(gè)表示模板的優(yōu)先級(jí)編號(hào)的數(shù)字。

實(shí)例

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="cd">
<p>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="artist"/>
</p>
</xsl:template>
<xsl:template match="title">
Title: <span style="color:#ff0000">
<xsl:value-of select="."/></span>
<br />
</xsl:template>
<xsl:template match="artist">
Artist: <span style="color:#00ff00">
<xsl:value-of select="."/></span>
<br />
</xsl:template>
</xsl:stylesheet>
Previous article: Next article: