Learning Xslt
暫譯: 學習 XSLT

Michael James Fitzgerald

  • 出版商: O'Reilly
  • 出版日期: 2003-12-23
  • 售價: $1,430
  • 貴賓價: 9.5$1,359
  • 語言: 英文
  • 頁數: 370
  • 裝訂: Paperback
  • ISBN: 0596003277
  • ISBN-13: 9780596003272
  • 相關分類: XML
  • 已過版

買這商品的人也買了...

商品描述

Summary

XSLT is a powerful language for transforming XML documents into something else. That something else can be an HTML document, another XML document, a Portable Document Format (PDF) file, a Scalable Vector Graphics (SVG) file, a Virtual Reality Modeling Language (VRML) file, Java code, or a number of other things. You write an XSLT stylesheet to define the rules for transforming an XML document, and the XSLT processor does the work.

As useful as XSLT is, its peculiar characteristics make it a difficult language in which to get started. In fact, newcomers are often a little dazed on first contact. Learning XSLT offers a hands-on introduction to help them get up to speed with XSLT quickly. The book will help web developers and designers understand this powerful but often mystifying template-driven and functional-styled language, getting them over the many differences between XSLT and the more conventional programming languages.

Learning XSLT moves smoothly from the simple to complex, illustrating all aspects of XSLT 1.0 through step-by-step examples that you'll practice as you work through the book. Thorough in its coverage of the language, the book makes few assumptions about what you may already know. You'll learn about XSLT's template-based syntax, how XSLT templates work with each other, and gain an understanding of XSLT variables. Learning XSLT also explains how the XML Path Language (XPath) is used by XSLT and provides a glimpse of what the future holds for XSLT 2.0 and XPath 2.0.

The ability to transform one XML vocabulary to another is fundamental to exploiting the power of XML. Learning XSLT is a carefully paced, example-rich introduction to XSLT that will have you understanding and using XSLT on your own in no time.

Table of Contents

Preface

1. Transforming Documents with XSLT
     How XSLT Works
     Using Client-Side XSLT in a Browser
     Using apply-templates

2. Building New Documents with XSLT
     Outputting Text
     Literal Result Elements
     Using the Element Called element
     Adding Attributes
     Outputting Comments
     Outputting Processing Instructions
     One Final Example

3. Controlling Output
     The Output Method
     Outputting XML
     Outputting HTML
     Outputting Text
     Using a QName Output Method
     Media Types

4. Traversing the Tree
     The XPath Data Model
     Location Paths
     Expressions
     What Is a Pattern?
     Predicates
     Axes
     Name and Node Tests
     Doing the Math with Expressions

5. XPath and XSLT Functions
     Boolean Functions
     Node-Set Functions
     Number Functions
     String Functions

6. Copying Nodes
     The copy Element
     The copy-of Element
     Copying Nodes from Two Documents

7. Using Variables and Parameters
     Defining Variables and Parameters
     Using Variables
     Using Parameters
     Invoking Templates with Parameters
     Using Result Tree Fragments

8. Sorting Things Out
     Simple Ascending Sort
     Reversing the Sort
     By the Numbers
     Multiple Sorts
     The lang and case-order Attributes

9. Numbering Lists
     Numbered Lists
     Alphabetical Lists
     Roman Numerals
     Inserting an Individual Formatted Value
     Numbering Levels
     The from Attribute
     The lang and letter-value Attributes
     More Help with Formatted Numbers

10. Templates
     Template Priority
     Calling a Named Template
     Using Templates with Parameters
     Modes
     Built-in Template Rules

11. Using Keys
     A Simple Key
     More Than One Key
     Using a Parameter with Keys
     Cross-Referencing with Keys
     Grouping with Keys

12. Conditional Processing
     The if Element
     The choose and when Elements

13. Working with Multiple Documents
     Including Stylesheets
     Importing Stylesheets
     Using the document( ) Function

14. Alternative Stylesheets
     A Literal Result Element Stylesheet
     An Embedded Stylesheet
     Aliasing a Namespace
     Excluding Namespaces

15. Extensions
     Xalan, Saxon, and EXSLT Extensions
     Using a Saxon Extension Attribute
     Result Tree Fragment to Node-Set
     Using EXSLT
     Fallback Behavior
     Checking for Extension Availability

16. XSLT 2.0 and XPath 2.0
     New XSLT 2.0 Features
     New XPath 2.0 Features
     Multiple Result Trees
     Using Regular Expressions
     Grouping in XSLT 2.0
     Extension Functions

17. Writing an XSLT ProcessorInterface
     Running an XSLT Processor from Java
     Writing an XSLT Processor with C#

18. Parting Words
     The Ox Documentation Tool
     Signing Off

Appendix: XSLT Processors

Glossary

Index

商品描述(中文翻譯)

**摘要**

XSLT 是一種強大的語言,用於將 XML 文件轉換為其他格式。這些其他格式可以是 HTML 文件、另一個 XML 文件、可攜式文檔格式 (PDF) 文件、可縮放向量圖形 (SVG) 文件、虛擬現實建模語言 (VRML) 文件、Java 代碼或其他多種格式。您編寫 XSLT 樣式表來定義轉換 XML 文件的規則,而 XSLT 處理器則負責執行這些轉換。

儘管 XSLT 非常有用,但其特殊特性使得初學者在開始時會感到困難。事實上,新手在第一次接觸時常常會感到有些迷惑。《學習 XSLT》提供了一個實用的入門介紹,幫助他們快速掌握 XSLT。本書將幫助網頁開發人員和設計師理解這種強大但常常令人困惑的基於模板和函數風格的語言,幫助他們克服 XSLT 與更傳統編程語言之間的許多差異。

《學習 XSLT》從簡單到複雜,通過逐步示例說明 XSLT 1.0 的各個方面,您將在閱讀本書的過程中進行實踐。該書對語言的覆蓋非常全面,對於您可能已經知道的內容幾乎沒有假設。您將學習 XSLT 的基於模板的語法、XSLT 模板之間的相互作用,並了解 XSLT 變量。《學習 XSLT》還解釋了 XML 路徑語言 (XPath) 如何被 XSLT 使用,並提供了對 XSLT 2.0 和 XPath 2.0 未來的展望。

將一種 XML 詞彙轉換為另一種是充分利用 XML 功能的基礎。《學習 XSLT》是一個精心安排、示例豐富的 XSLT 入門書籍,將使您迅速理解並獨立使用 XSLT。

**目錄**

前言

1. 使用 XSLT 轉換文檔
- XSLT 的工作原理
- 在瀏覽器中使用客戶端 XSLT
- 使用 apply-templates

2. 使用 XSLT 建立新文檔
- 輸出文本
- 文字結果元素
- 使用名為 element 的元素
- 添加屬性
- 輸出註釋
- 輸出處理指令
- 最後一個示例

3. 控制輸出
- 輸出方法
- 輸出 XML
- 輸出 HTML
- 輸出文本
- 使用 QName 輸出方法
- 媒體類型

4. 遍歷樹
- XPath 數據模型
- 位置路徑
- 表達式
- 什麼是模式?
- 條件
- 軸
- 名稱和節點測試
- 使用表達式進行計算

5. XPath 和 XSLT 函數
- 布林函數
- 節點集函數
- 數字函數
- 字符串函數

6. 複製節點
- copy 元素
- copy-of 元素
- 從兩個文檔複製節點

7. 使用變量和參數
- 定義變量和參數
- 使用變量
- 使用參數
- 使用參數調用模板
- 使用結果樹片段

8. 整理事物
- 簡單的升序排序
- 反向排序
- 按數字排序
- 多重排序
- lang 和 case-order 屬性

9. 編號列表
- 編號列表
- 字母列表
- 羅馬數字
- 插入單個格式化值
- 編號層級
- from 屬性
- lang 和 letter-value 屬性
- 更多格式化數字的幫助

10. 模板
- 模板優先級
- 調用命名模板
- 使用帶參數的模板
- 模式
- 內建模板規則

11. 使用鍵
- 簡單鍵
- 多個鍵
- 使用參數與鍵
- 使用鍵進行交叉引用
- 使用鍵進行分組

12. 條件處理
- if 元素
- choose 和 when 元素

13. 處理多個文檔
- 包含樣式表
- 導入樣式表
- 使用 document() 函數

14. 替代樣式表
- 文字結果元素樣式表
- 嵌入樣式表
- 別名命名空間
- 排除命名空間

15. 擴展
- Xalan、Saxon 和 EXSLT 擴展
- 使用 Saxon 擴展屬性
- 結果樹片段到節點集
- 使用 EXSLT
- 回退行為
- 檢查擴展可用性

16. XSLT 2.0 和 XPath 2.0
- 新的 XSLT 2.0 特性
- 新的 XPath 2.0 特性
- 多個結果樹
- 使用正則表達式
- XSLT 2.0 中的分組
- 擴展函數

17. 編寫 XSLT 處理器介面
- 從 Java 運行 XSLT 處理器
- 使用 C# 編寫 XSLT 處理器

18. 結語
- Ox 文檔工具
- 簽名

附錄:XSLT 處理器

詞彙表

索引