將 HTML 標頭新增至 XSL 檔中

有時候,您可能要利用 XSL 檔來產生 HTML 檔(從 XML 文件)。要執行這項作業,您可以建立含有 <html> 標頭以及適當 <xsl:output> 元素的範本。

以下是針對「資源」視景撰寫的指示, 但是它們也適用於許多其他視景。

請遵循下列步驟,將 HTML 範本新增至 XSL 檔中:

  1. 在 XSL 編輯器中開啟您的 XSL 檔。
  2. 按一下片段標籤,開啟 XSL 抽屜, 然後按兩下預設 HTML 標頭

XSL 檔將會出現下列文字:

<xsl:output method="html" encoding="UTF-8"/>
<xsl:template match="/">
 <html> 
<head> 
   <title>Untitled</title> 
 </head> 
     <body> 
   <xsl:apply-templates/> 
     </body> 
</html> 
 </xsl:template>

<xsl:apply-templates/> 元素將會遞迴處理套用 XSL 檔之 XML 文件的所有子項。

使用條款 | 讀者意見
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.