XSLT Cookbook, 2/e
暫譯: XSLT 食譜(第二版)

Sal Mangano

  • 出版商: O'Reilly
  • 出版日期: 2006-01-17
  • 售價: $2,040
  • 貴賓價: 9.5$1,938
  • 語言: 英文
  • 頁數: 778
  • 裝訂: Paperback
  • ISBN: 0596009747
  • ISBN-13: 9780596009748
  • 相關分類: XML
  • 海外代購書籍(需單獨結帳)

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

相關主題

商品描述

Description

Forget those funky robot toys that were all the rage in the '80s, XSLT (Extensible Stylesheet Transformations) is the ultimate transformer. This powerful language is expert at transforming XML documents into PDF files, HTML documents, JPEG files--virtually anything your heart desires. As useful as XSLT is, though, most people have a difficult time learning its many peculiarities. And now Version 2.0, while elegant and powerful, has only added to the confusion.


XSLT Cookbook, Second Edition wants to set the record straight. It helps you sharpen your programming skills and overall understanding of XSLT through a collection of detailed recipes. Each recipe breaks down a specific problem into manageable chunks, giving you an easy-to-grasp roadmap for integrating XSLT with your data and applications. No other XSLT book around employs this practical problem-solution-discussion format.


In addition to offering code recipes for solving everyday problems with XSLT 1.0, this new edition shows you how to leverage the improvements found in XSLT 2.0, such as how to simplify the string manipulation and date/time conversion processes. The book also covers XPath 2.0, a critical companion standard, as well as topics ranging from basic transformations to complex sorting and linking. It even explores extension functions on a variety of different XSLT processors and shows ways to combine multiple documents using XSLT. Code examples add a real-world dimension to each technique.

Table of Contents

Preface

1. XPath

      1.1 Effectively Using Axes  

      1.2 Filtering Nodes  

      1.3 Working with Sequences  

      1.4 Shrinking Conditional Code with If Expressions  

      1.5 Eliminating Recursion with for Expressions  

      1.6 Taming Complex Logic Using Quantifiers  

      1.7 Using Set Operations  

      1.8 Using Node Comparisons  

      1.9 Coping with XPath 2.0's Extended Type System  

      1.10 Exploiting XPath 2.0's Extended Type System  

2. Strings

      2.1 Testing If a String Ends with Another String  

      2.2 Finding the Position of a Substring  

      2.3 Removing Specific Characters from a String  

      2.4 Finding Substrings from the End of a String  

      2.5 Duplicating a String N Times  

      2.6 Reversing a String  

      2.7 Replacing Text  

      2.8 Converting Case  

      2.9 Tokenizing a String  

      2.10 Making Do Without Regular Expressions  

      2.11 Exploiting Regular Expressions  

      2.12 Using the EXSLT String Extensions  

3. Numbers and Math

      3.1 Formatting Numbers  

      3.2 Rounding Numbers to a Specified Precision  

      3.3 Converting from Roman Numerals to Numbers  

      3.4 Converting from One Base to Another  

      3.5 Implementing Common Math Functions  

      3.6 Computing Sums and Products  

      3.7 Finding Minimums and Maximums  

      3.8 Computing Statistical Functions  

      3.9 Computing Combinatorial Functions  

      3.10 Testing Bits  

4. Dates and Times

      4.1 Calculating the Day of the Week  

      4.2 Determining the Last Day of the Month  

      4.3 Getting Names for Days and Months  

      4.4 Calculating Julian and Absolute Day Numbersfrom a Specified Date  

      4.5 Calculating the Week Number for aSpecified Date  

      4.6 Working with the Julian Calendar  

      4.7 Working with the ISO Calendar  

      4.8 Working with the Islamic Calendar  

      4.9 Working with the Hebrew Calendar  

      4.10 Formatting Dates and Times  

      4.11 Determining Secular and Religious Holidays  

5. Selecting and Traversing

      5.1 Ignoring Duplicate Elements  

      5.2 Selecting All but a Specific Element  

      5.3 Selecting Nodes by Context  

      5.4 Performing a Preorder Traversal  

      5.5 Performing a Postorder Traversal  

      5.6 Performing an In-Order Traversal  

      5.7 Performing a Level-Order Traversal  

      5.8 Processing Nodes by Position  

6. Exploiting XSLT 2.0

      6.1 Convert Simple Named Templates to XSLT Functions  

      6.2 Prefer for-each-group over Muenchian Method of Grouping  

      6.3 Modularizing and Modes  

      6.4 Using Types for Safety and Precision  

      6.5 Avoiding 1.0 to 2.0 Porting Pitfalls  

      6.6 Emulating Object-Oriented Reuse and Design Patterns  

      6.7 Processing Unstructured Text with Regular Expressions  

      6.8 Solving Difficult Serialization Problems with Character Maps  

      6.9 Outputting Multiple Documents  

      6.10 Handling String Literals Containing Quote Characters  

      6.11 Understanding the New Capabilities of Old XSLT 1.0 Features  

7. XML to Text

      7.1 Dealing with Whitespace  

      7.2 Exporting XML to Delimited Data  

      7.3 Creating a Columnar Report  

      7.4 Displaying a Hierarchy  

      7.5 Numbering Textual Output  

      7.6 Wrapping Text to a Specified Width and Alignment  

8. XML to XML

      8.1 Converting Attributes to Elements  

      8.2 Converting Elements to Attributes  

      8.3 Renaming Elements or Attributes  

      8.4 Merging Documents with Identical Schema  

      8.5 Merging Documents with Unlike Schema  

      8.6 Splitting Documents  

      8.7 Flattening an XML Hierarchy  

      8.8 Deepening an XML Hierarchy  

      8.9 Reorganizing an XML Hierarchy  

9. Querying XML

      9.1 Performing Set Operations on Node Sets  

      9.2 Performing Set Operations on Node Sets Using Value Semantics  

      9.3 Determining Set Equality by Value  

      9.4 Performing Structure-Preserving Queries  

      9.5 Joins  

      9.6 Implementing the W3C XML Query-Use Cases in XSLT  

10. XML to HTML

      10.1 Using XSLT as a Styling Language  

      10.2 Creating Hyperlinked Documents  

      10.3 Creating HTML Tables  

      10.4 Creating Frames  

      10.5 Creating Data-Driven Stylesheets  

      10.6 Creating a Self-Contained HTML Transformation  

      10.7 Populating a Form  

11. XML to SVG

      11.1 Transforming an Existing Boilerplate SVG  

      11.2 Creating Reusable SVG Generation Utilities for Graphs and Charts
      11.3 Creating a Tree Diagram  

      11.4 Creating Interactive SVG-Enabled Web Pages  

12. Code Generation

      12.1 Generating Constant Definitions  

      12.2 Generating Switching Code  

      12.3 Generating Message-Handling Stub Code  

      12.4 Generating Data Wrappers  

      12.5 Generating Pretty Printers  

      12.6 Generating a Test Data-Entry Web Client  

      12.7 Generating Test-Entry Web CGI  

      12.8 Generating Code from UML Models via XMI  

      12.9 Generating XSLT from XSLT  

13. Vertical XSLT Application Recipes

      13.1 Converting Visio VDX Documents to SVG  

      13.2 Working with Excel XML Spreadsheets  

      13.3 Generating XTM Topic Maps from UML Models via XMI  

      13.4 Generating Web Sites from XTM Topic Maps  

      13.5 Serving SOAP Documentation from WSDL  

14. Extending and Embedding XSLT

      14.1 Saxon Extension Functions  

      14.2 Saxon Extension Elements  

      14.3 Xalan-Java 2 Extension Functions  

      14.4 Java Extension Function Using the Class Format Namespace  

      14.5 Java Extension Function Using the Package Format Namespace  

      14.6 Java Extension Function Using the Java Format Namespace  

      14.7 Scripting Extension Function Using Inline Script Code  

      14.8 Xalan-Java 2 Extension Elements  

      14.9 Java Extension Element  

      14.10 Scripting Extension Elements  

      14.11 MSXML Extension Functions  

      14.12 Using Saxon's and Xalan's Native Extensions  

      14.13 Extending XSLT with JavaScript  

      14.14 Adding Extension Functions Using Java  

      14.15 Adding Extension Elements Using Java  

      14.16 Using XSLT from Perl  

      14.17 Using XSLT from Java  

15. Testing and Debugging

      15.1 Using xsl:message Effectively  

      15.2 Tracing the Flow of Your Stylesheet Through Its Input Document  

      15.3 Automating the Insertion of Debug Output  

      15.4 Including Embedded Unit Test Data in Utility Stylesheets  

      15.5 Structuring Unit Tests  

      15.6 Testing Boundary and Error Conditions  

16. Generic and Functional Programming

      16.1 Creating Polymorphic XSLT  

      16.2 Creating Generic Element Aggregation Functions  

      16.3 Creating Generic Bounded Aggregation Functions  

      16.4 Creating Generic Mapping Functions  

      16.5 Creating Generic Node-Set Generators  

Index

商品描述(中文翻譯)

描述
忘掉那些在80年代風靡一時的奇特機器人玩具吧,XSLT(可擴展樣式表轉換)才是真正的變形金剛。這種強大的語言擅長將XML文檔轉換為PDF文件、HTML文檔、JPEG文件——幾乎任何你想要的格式。儘管XSLT非常有用,但大多數人學習它的許多特性時都會感到困難。而現在的2.0版本,雖然優雅且強大,卻只增加了混淆。
《XSLT Cookbook, Second Edition》希望澄清這一點。它通過一系列詳細的食譜幫助你提高編程技能和對XSLT的整體理解。每個食譜將特定問題分解為可管理的部分,為你提供一個易於理解的路線圖,以便將XSLT與你的數據和應用程序集成。市面上沒有其他XSLT書籍採用這種實用的問題-解決-討論格式。
除了提供解決日常問題的XSLT 1.0代碼食譜外,這本新版本還展示了如何利用XSLT 2.0中的改進,例如如何簡化字符串操作和日期/時間轉換過程。本書還涵蓋了XPath 2.0,這是一個關鍵的伴隨標準,以及從基本轉換到複雜排序和鏈接的主題。它甚至探討了在各種XSLT處理器上擴展函數的使用,並展示了如何使用XSLT合併多個文檔。代碼示例為每個技術增添了現實世界的維度。

目錄
前言
1. XPath
      1.1 有效使用軸
      1.2 篩選節點
      1.3 處理序列
      1.4 使用If表達式縮減條件代碼
      1.5 使用for表達式消除遞歸
      1.6 使用量詞駕馭複雜邏輯
      1.7 使用集合操作
      1.8 使用節點比較
      1.9 應對XPath 2.0的擴展類型系統
      1.10 利用XPath 2.0的擴展類型系統
2. 字符串
      2.1 測試字符串是否以另一個字符串結尾
      2.2 查找子字符串的位置
      2.3 從字符串中移除特定字符
      2.4 從字符串末尾查找子字符串
      2.5 重複字符串N次
      2.6 反轉字符串
      2.7 替換文本
      2.8 轉換大小寫
      2.9 將字符串標記化
      2.10 無需正則表達式的解決方案
      2.11 利用正則表達式
      2.12 使用EXSLT字符串擴展
3. 數字與數學
      3.1 格式化數字
      3.2 將數字四捨五入到指定精度
      3.3 將羅馬數字轉換為數字
      3.4 將一個基數轉換為另一個基數
      3.5 實現常見數學函數
      3.6 計算總和和乘積
      3.7 查找最小值和最大值
      3.8 計算統計函數
      3.9 計算組合函數
      3.10 測試位元
4. 日期與時間
      4.1 計算星期幾
      4.2 確定月份的最後一天
      4.3 獲取星期和月份的名稱
      4.4 從指定日期計算儒略日和絕對日數
      4.5 計算指定日期的週數
      4.6 使用儒略曆
      4.7 使用ISO曆
      4.8 使用伊斯蘭曆
      4.9 使用希伯來曆
      4.10 格式化日期和時間
      4.11 確定世俗和宗教假期
5. 選擇與遍歷
      5.1 忽略重複元素
      5.2 選擇所有但特定元素
      5.3 根據上下文選擇節點
      5.4 執行前序遍歷
      5.5 執行後序遍歷
      5.6 執行中序遍歷
      5.7 執行層次遍歷
      5.8 根據位置處理節點
6. 利用XSLT 2.0
      6.1 將簡單命名模板轉換為XSLT函數
      6.2 優先使用for-each-group而非Muenchian分組方法
      6.3 模組化和模式
      6.4 使用類型以確保安全性和精確性
      6.5 避免1.0到2.0的移植陷阱
      6.6 模擬面向對象的重用和設計模式
      6.7 使用正則表達式處理非結構化文本
      6.8 使用字符映射解決困難的序列化問題
      6.9 輸出多個文檔
      6.10 處理包含引號字符的字符串字面量
      6.11 理解舊XSLT 1.0功能的新能力
7. XML轉文本
      7.1 處理空白字符
      7.2 將XML導出為分隔數據
      7.3 創建列報告
      7.4 顯示層次結構
      7.5 為文本輸出編號
      7.6 將文本包裝到指定寬度和對齊方式
8. XML轉XML
      8.1 將屬性轉換為元素
      8.2 將元素轉換為屬性
      8.3 重新命名元素或屬性
      8.4 合併具有相同架構的文檔
      8.5 合併具有不同架構的文檔
      8.6 拆分文檔
      8.7 扁平化XML層次結構
      8.8 加深XML層次結構
      8.9 重新組織XML層次結構
9. 查詢XML
      9.1 在節點集上執行集合操作
      9.2 使用值語義在節點集上執行集合操作
      9.3 通過值確定集合相等性
      9.4 執行結構保留查詢
      9.5 連接
      9.6 在XSLT中實現W3C XML查詢用例
10. XML轉HTML
      10.1 將XSLT用作樣式語言
      10.2 創建超鏈接文檔
      10.3 創建HTML表格
      10.4 創建框架
      10.5 創建數據驅動的樣式表
      10.6 創建自包含的HTML轉換
      10.7 填充表單
11. XML轉SVG
      11.1 轉換現有的樣板SVG
      11.2 為圖表和圖形創建可重用的SVG生成工具
      11.3 創建樹狀圖
      11.4 創建互動式SVG啟用的網頁
12. 代碼生成
      12.1 生成常量定義
      12.2 生成切換代碼
      12.3 生成消息處理存根代碼
      12.4 生成數據包裝器
      12.5 生成美化打印程序
      12.6 生成測試數據輸入網頁客戶端
      12.7 生成測試輸入網頁CGI
      12.8 通過XMI從UML模型生成代碼
      12.9 從XSLT生成XSLT
13. 垂直XSLT應用食譜
      13.1 將Visio VDX文檔轉換為SVG
      13.2 使用Excel XML電子表格
      13.3 通過XMI從UML模型生成XTM主題圖
      13.4 從XTM主題圖生成網站
      13.5 從WSDL提供SOAP文檔
14. 擴展和嵌入XSLT
      14.1 Saxon擴展函數
      14.2 Saxon擴展元素
      14.3 Xalan-Java 2擴展函數
      14.4 使用類格式命名空間的Java擴展函數
      14.5 使用Java擴展函數