XSLT. 2nd Edition - Helion
ISBN: 978-14-493-9112-6
stron: 990, Format: ebook
Data wydania: 2008-06-26
Księgarnia: Helion
Cena książki: 152,15 zł (poprzednio: 176,92 zł)
Oszczędzasz: 14% (-24,77 zł)
After years of anticipation and delay, the W3C finally released the XSLT 2.0 standard in January 2007. The revised edition of this classic book offers practical, real-world examples that demonstrate how you can apply XSLT stylesheets to XML data using either the new specification, or the older XSLT 1.0 standard.
XSLT is a critical language for converting XML documents into other formats, such as HTML code or a PDF file. With XSLT, you get a thorough understanding of XSLT and XPath and their relationship to other web standards, along with recommendations for a honed toolkit in an open platform-neutral, standards-based environment. This book:
- Covers the XSLT basics, including simple stylesheets and methods for setting up transformation engines
- Walks you through the many parts of XSLT, particularly XSLT's template-based approach to transformations
- Applies both XSLT 1.0 and 2.0 solutions to the same problems, helping you decide which version of XSLT is more appropriate for your project
- Includes profuse examples that complement both the tutorial and the reference material
The new edition of XSLT has been updated thoroughly to explain XSLT 2.0's many dependencies, notably XML Schema and XPath 2.0. Want to find out how the 2.0 specification improves on the old? This book will explain.
Osoby które kupowały "XSLT. 2nd Edition", wybierały także:
- Data Science w Pythonie. Kurs video. Algorytmy uczenia maszynowego 199,00 zł, (59,70 zł -70%)
- Power BI Desktop. Kurs video. Wykorzystanie narzędzia w analizie i wizualizacji danych 349,00 zł, (104,70 zł -70%)
- Statystyka. Kurs video. Przewodnik dla student 128,71 zł, (39,90 zł -69%)
- Microsoft Excel. Kurs video. Wykresy i wizualizacja danych 199,00 zł, (69,65 zł -65%)
- Analiza danych w Tableau. Kurs video. Podstawy pracy analityka 249,00 zł, (87,15 zł -65%)
Spis treści
XSLT. 2nd Edition eBook -- spis treści
- XSLT
- SPECIAL OFFER: Upgrade this ebook with OReilly
- A Note Regarding Supplemental Files
- Preface
- About This Book
- Where Im Coming From
- I Believe in Open, Platform-Neutral, Standards-Based Computing
- I Assume Youre Busy
- I Dont Care Which Standards-Compliant Tools You Use
- XSLT Is a Tool, Not a Religion
- You Shouldnt Migrate All of Your Stylesheets Just Because Theres a New Version of XSLT
- How This Book Is Organized
- Conventions Used in This Book
- How to Contact Us
- Safari Enabled
- Acknowledgments for the Second Edition
- Acknowledgments from the First Edition
- 1. Getting Started
- The Design of XSLT
- [2.0] The Design of XSLT 2.0
- XML Basics
- XMLs Heritage
- XML Document Rules
- An XML document must be contained in a single element
- All elements must be nested
- All attributes must be quoted
- XML tags are case-sensitive
- All end tags are required
- Empty tags can contain the end marker
- XML declarations
- Document Type Definitions (DTDs) and XML Schemas
- Well-formed versus valid documents
- Tags versus elements
- Namespaces
- [2.0] Datatypes
- Programming Interfaces for XML: DOM, SAX, and Others
- DOM
- A sample DOM tree
- SAX
- Other programming interfaces
- DOM
- XSLT Standards
- XSL transformations (XSLT) version 1.0
- XML path language (XPath) version 1.0
- XSL transformations (XSLT) version 2.0
- XML path language (XPath) version 2.0
- XQuery 1.0 and XPath 2.0 Data Model (XDM)
- XQuery 1.0 and XPath 2.0 functions and operators
- XQuery 1.0 and XPath 2.0 formal semantics
- XSLT 2.0 and XQuery 1.0 serialization
- XQuery 1.0: an XML query language
- XML syntax for XQuery 1.0 (XQueryX)
- XML Standards
- XML 1.0
- XML 1.1
- The Extensible Stylesheet Language (XSL)
- XML Schemas
- RelaxNG
- Schematron
- The Simple API for XML (SAX)
- Document Object Model (DOM)
- Namespaces in XML
- Associating stylesheets with XML documents
- Scalable Vector Graphics (SVG)
- XML pointer language (XPointer) version 1.0
- XML linking language (XLink) version 1.0
- Installing XSLT Processors
- Installing Xalan
- Installing Saxon
- Installing the Microsoft XSLT Processor
- Installing the Altova XSLT Engine
- Summary
- The Design of XSLT
- 2. The Obligatory Hello World Example
- Goals of This Chapter
- Transforming Hello World
- Our Sample Document
- A Sample Stylesheet
- Transforming the XML Document
- Stylesheet Results
- How a Stylesheet Is Processed
- Parsing the Stylesheet
- Parsing the Transformee
- Lather, Rinse, Repeat
- Walking Through Our Example
- Stylesheet Structure
- The <xsl:stylesheet> Element
- The <xsl:output> Element
- Our First <xsl:template>
- The <xsl:template> for <greeting> Elements
- Built-in Template Rules
- Built-in template rule for element and document nodes
- Built-in template rule for modes
- Built-in template rule for text and attribute nodes
- Built-in template rule for comment and processing instruction nodes
- Built-in template rule for namespace nodes
- Top-Level Elements
- Other Approaches
- Sample Gallery
- The Hello World SVG File
- The Hello World PDF File
- The Hello World Java Program
- The Hello World VRML File
- Summary
- 3. XPath: A Syntax for Describing Needles and Haystacks
- The XPath Data Model
- Node Types
- The root node
- Element nodes
- Attribute nodes
- Text nodes
- Comment nodes
- Processing instruction nodes
- Namespace nodes
- Node Tests
- [2.0] New node tests in XPath 2.0
- [2.0] Sequences and Atomic Values
- Node Types
- Location Paths
- The Context
- [1.0] The XPath 1.0 context
- [2.0] The XPath 2.0 context
- Simple Location Paths
- Relative and Absolute Expressions
- Selecting Things Besides Elements with Location Paths
- Selecting attributes
- Selecting the text of an element
- Selecting comments, processing instructions, and namespace nodes
- Using Wildcards
- Axes
- Unabbreviated syntax
- Axis roll call
- Predicates
- Numbers in predicates
- Functions in predicates
- The Context
- Attribute Value Templates
- Datatypes
- Datatypes in XPath 1.0
- Datatypes in XPath 2.0
- XPath Operators
- Mathematical Operators
- Addition (+)
- Subtraction ()
- Multiplication (*)
- Division (div)
- [2.0] Integer division (idiv)
- Modulo (mod)
- Unary minus (x)
- Unary plus (+x)
- Boolean Operators
- Comparing expressions
- [2.0] Comparing atomic values
- [2.0] Comparing sequences
- [2.0] Conditional Expressionsif, then, and else
- [2.0] Iterators Over SequencesThe for Operator
- [2.0] Quantified Expressionssome and every
- [2.0] Range ExpressionsThe to Operator
- [2.0] Constructor Functions
- [2.0] Datatype Operatorsinstance of, castable as, cast as, and treat as
- instance of
- cast as
- castable as
- treat as
- [2.0] Set Operatorsexcept, intersect, and union
- except
- intersect
- union
- [2.0] Node Operators
- The is operator
- node-after (>>)
- node-before (<<)
- Mathematical Operators
- [2.0] Comments in XPath Expressions
- [2.0] Types of XSLT 2.0 Processors
- The XPath View of an XML Document
- Output View
- The Stylesheet
- Summary
- The XPath Data Model
- 4. Creating Output
- Goals of This Chapter
- Generating Text
- Creating Simple Text
- Outputting the Value of Something
- [2.0] Changes to <xsl:value-of> in XSLT 2.0
- Numbering Things
- [2.0] Changes to <xsl:number> in XSLT 2.0
- Formatting Decimal Numbers
- [2.0] Formatting Dates and Times
- Using <xsl:copy> and <xsl:copy-of>
- A Stylesheet That Reproduces Its Input Document
- A Stylesheet That Doesnt Quite Reproduce Its Input Document
- Dealing with Whitespace
- Whitespace Basics
- Using <xsl:preserve-space> and <xsl:strip-space>
- The normalize-space() function
- A Simple Technique for Adding Whitespace to Text Output
- Summary
- 5. Branching and Control Elements
- Goals of This Chapter
- Branching Elements of XSLT
- The <xsl:if> Element
- Converting to boolean values
- Boolean examples
- The <xsl:choose> Element
- <xsl:choose> example
- The <xsl:for-each> Element
- <xsl:for-each> example
- The <xsl:if> Element
- Invoking Templates by Name
- How It Works
- Templates la mode
- Parameters
- Defining a Parameter in a Template
- Passing Parameters
- Global Parameters
- Setting global parameters in a Java program
- Setting global parameters in .NET
- [2.0] Important Differences in XSLT 2.0
- New values for the mode attribute
- Undefined parameters are illegal
- Required parameters
- Datatyping support
- Tunnel parameters
- Variables
- Are These Things Really Variables?
- Variable Scope
- Using Recursion to Do Most Anything
- Implementing a String Replace Function
- Procedural design
- Recursive design
- [2.0] Using the XPath 2.0 replace() Function to Avoid Recursion
- Implementing a String Replace Function
- A Stylesheet That Emulates a for Loop
- Template Design
- Implementation
- The Complete Example
- Summary
- 6. Creating Links and Cross-References
- Using the XML ID, IDREF, and IDREFS Datatypes
- The Datatypes and How They Work
- Linking Parts of an XML Document
- A Stylesheet That Uses the id() Function
- [2.0] The idref() Function
- Generating HTML Documents with Links
- Limitations of IDs
- XSLTs Key Facility
- Defining a Key with <xsl:key>
- Generating Links with the key() Function
- Advantages of the key() Function
- Generating Links in Unstructured Documents
- An Unstructured XML Document in Need of Links
- The generate-id() Function
- Summary
- Using the XML ID, IDREF, and IDREFS Datatypes
- 7. Sorting and Grouping Elements
- Sorting Data with <xsl:sort>
- Our First Example
- The Details on the <xsl:sort> Element
- Whats the deal with that syntax?
- Attributes
- Where can you use <xsl:sort>?
- Another Example
- [2.0] The <xsl:perform-sort> Element
- Grouping Nodes
- Our First Attempt
- A Brute-Force Approach
- Grouping with <xsl:variable>
- The <xsl:key> Approach
- [2.0] New Grouping Syntax in XSLT 2.0
- The Most Common Grouping Style: group-by
- Another Type of Grouping: group-adjacent
- Grouping using group-starting-with
- Grouping Using group-ending-with
- Summary
- Sorting Data with <xsl:sort>
- 8. Combining Documents
- The document() Function
- An Aside: Doing Math with Recursion
- Recursive design
- Using format-number() to control output
- Base URIs and the document() Function
- An Aside: Doing Math with Recursion
- The document() Function and Sorting
- Implementing Lookup Tables
- Grouping Across Multiple Documents
- [2.0] Using XSLT 2.0 to Simplify Things
- Grouping by Distinct Values
- Doing Math Without Recursion
- Implementing Lookup Tables with <xsl:function>
- Using if Instead of <xsl:choose>
- Using the format-date() Function
- The Complete XSLT 2.0 Solution
- [2.0] The doc() and doc-available() Functions
- [2.0] The collection() Function
- [2.0] The unparsed-text() and unparsed-text-available() Functions
- Summary
- The document() Function
- 9. Extending XSLT
- The XSLT Extension Mechanism
- Extension Elements
- Extension Functions
- Fallback Processing
- Namespaces for Extensions
- [2.0] Creating New Functions with <xsl:function>
- Example: Generating Multiple Output Files
- Creating Custom Collations
- Using a Custom Collation for Sorting
- Using a Custom Collation for Comparing Text
- Generating Hidden Word Graphics
- Java Version
- .NET Version
- Example: Generating an SVG Pie Chart
- Writing Extensions in Other Languages
- Jython
- JRuby
- JavaScript
- Jacl
- Using Extension Functions from the EXSLT Library
- Accessing a Database with an Extension Element
- Accessing a Database in Saxon
- Accessing a Database in Xalan
- Creating a Photo Album with an Extension Element
- Xalan Java Version
- Saxon Java Version
- .NET Version
- Summary
- The XSLT Extension Mechanism
- A. XSLT Reference
- [2.0] Attributes common to all XSLT elements
- [2.0] <xsl:analyze-string>
- <xsl:apply-imports>
- <xsl:apply-templates>
- <xsl:attribute>
- <xsl:attribute-set>
- <xsl:call-template>
- [2.0] <xsl:character-map>
- <xsl:choose>
- <xsl:comment>
- <xsl:copy>
- <xsl:copy-of>
- <xsl:decimal-format>
- [2.0] <xsl:document>
- <xsl:element>
- <xsl:fallback>
- <xsl:for-each>
- [2.0] <xsl:for-each-group>
- [2.0] <xsl:function>
- <xsl:if>
- <xsl:import>
- [2.0 Schema] <xsl:import-schema>
- <xsl:include>
- <xsl:key>
- [2.0] <xsl:matching-substring>
- <xsl:message>
- [2.0] <xsl:namespace>
- <xsl:namespace-alias>
- [2.0] <xsl:next-match>
- [2.0] <xsl:non-matching-substring>
- <xsl:number>
- <xsl:otherwise>
- <xsl:output>
- [2.0] <xsl:output-character>
- <xsl:param>
- [2.0] <xsl:perform-sort>
- <xsl:preserve-space>
- <xsl:processing-instruction>
- [2.0] <xsl:result-document>
- [2.0] <xsl:sequence>
- <xsl:sort>
- <xsl:strip-space>
- <xsl:stylesheet>
- <xsl:template>
- <xsl:text>
- <xsl:transform>
- <xsl:value-of>
- <xsl:variable>
- <xsl:when>
- <xsl:with-param>
- B. XPath Reference
- XPath Node Types
- The Root Node
- Element Nodes
- Attribute Nodes
- Text Nodes
- Comment Nodes
- Processing-Instruction Nodes
- Namespace Nodes
- XPath Node Tests
- XPath Axes
- The XPath Context
- XPath 1.0 Datatypes
- [2.0] XPath 2.0 Datatypes
- Operators and Keywords
- Operator PrecedenceXPath 1.0
- [2.0] Operator PrecedenceXQuery 1.0 and XPath 2.0
- XPath Node Types
- C. XSLT, XPath, and XQuery Function Reference
- Kinds of Functions
- Accessor Functions
- Boolean Functions
- Constructor Functions
- Context Functions
- Cross-Referencing and Grouping Functions
- Date, Time, and Duration Functions
- Node Functions
- Numeric Functions
- QName Functions
- Regular Expression Functions
- Sequence or Node-Set Functions
- String Functions
- Miscellaneous Functions
- Collation Functions
- [2.0] abs()
- [2.0] adjust-date-to-timezone()
- [2.0] adjust-dateTime-to-timezone()
- [2.0] adjust-time-to-timezone()
- [2.0] avg()
- [2.0] base-uri()
- boolean()
- ceiling()
- [2.0] codepoint-equal()
- [2.0] codepoints-to-string()
- [2.0] collection()
- [2.0] compare()
- concat()
- contains()
- count()
- current()
- [2.0] current-date()
- [2.0] current-dateTime()
- [2.0] current-group()
- [2.0] current-grouping-key()
- [2.0] current-time()
- [2.0] data()
- [2.0] dateTime()
- [2.0] day-from-date()
- [2.0] day-from-dateTime()
- [2.0] days-from-duration()
- [2.0] deep-equal()
- [2.0] default-collation()
- [2.0] distinct-values()
- [2.0] doc()
- [2.0] doc-available()
- document()
- [2.0] document-uri()
- element-available()
- [2.0] empty()
- [2.0] encode-for-uri()
- [2.0] ends-with()
- [2.0] error()
- [2.0] escape-html-uri()
- [2.0] exactly-one()
- [2.0] exists()
- false()
- floor()
- [2.0] format-date()
- [2.0] format-dateTime()
- format-number()
- [2.0] format-time()
- function-available()
- generate-id()
- [2.0] hours-from-dateTime()
- [2.0] hours-from-duration()
- [2.0] hours-from-time()
- id()
- [2.0] idref()
- [2.0] implicit-timezone()
- [2.0] in-scope-prefixes()
- [2.0] index-of()
- [2.0] insert-before()
- [2.0] iri-to-uri()
- key()
- lang()
- last()
- local-name()
- [2.0] local-name-from-QName()
- [2.0] lower-case()
- [2.0] matches()
- [2.0] max()
- [2.0] min()
- [2.0] minutes-from-dateTime()
- [2.0] minutes-from-duration()
- [2.0] minutes-from-time()
- [2.0] month-from-date()
- [2.0] month-from-dateTime()
- [2.0] months-from-duration()
- name()
- namespace-uri()
- [2.0] namespace-uri-for-prefix()
- [2.0] namespace-uri-from-QName()
- [2.0 Schema] nilled()
- [2.0] node-name()
- normalize-space()
- [2.0] normalize-unicode()
- not()
- number()
- [2.0] one-or-more()
- position()
- [2.0] prefix-from-QName()
- [2.0] QName()
- [2.0] regex-group()
- [2.0] remove()
- [2.0] replace()
- [2.0] resolve-QName()
- [2.0] resolve-uri()
- [2.0] reverse()
- [2.0] root()
- round()
- [2.0] round-half-to-even()
- [2.0] seconds-from-dateTime()
- [2.0] seconds-from-duration()
- [2.0] seconds-from-time()
- starts-with()
- [2.0] static-base-uri()
- string()
- [2.0] string-join()
- string-length()
- [2.0] string-to-codepoints()
- [2.0] subsequence()
- substring()
- substring-after()
- substring-before()
- sum()
- system-property()
- [2.0] timezone-from-date()
- [2.0] timezone-from-dateTime()
- [2.0] timezone-from-time()
- [2.0] tokenize()
- [2.0] trace()
- translate()
- true()
- [2.0] type-available()
- [2.0] unordered()
- [2.0] unparsed-entity-public-id()
- unparsed-entity-uri()
- [2.0] unparsed-text()
- [2.0] unparsed-text-available()
- [2.0] upper-case()
- [2.0] year-from-date()
- [2.0] year-from-dateTime()
- [2.0] years-from-duration()
- [2.0] zero-or-one()
- Kinds of Functions
- D. XML Schema Overview
- Declaring Elements and Attributes
- Creating an Empty Element
- Creating an Empty Element with Attributes
- Creating an Element with Text
- Creating an Element with Text and Attributes
- Creating an Element with Mixed Content
- Defining Datatypes
- Anonymous Types
- Groups
- Creating New Datatypes by Restriction
- Creating New Datatypes by Extension
- Casting Between Datatypes
- Creating List Types
- Creating Union Types
- Substitution Groups
- Abstract Elements and Datatypes
- Using an XML Schema in a Stylesheet
- Importing XML Schemas with <xsl:import-schema>
- Using XML Schemas Without Namespaces
- Using XML Schemas with Namespaces
- Declaring Elements and Attributes
- E. [2.0] Regular Expressions
- Simple Expressions
- Subexpressions
- Quantifiers
- [XPath] Reluctant Quantifiers
- Processing Modes
- [XPath] Anchors
- Back-references
- Metacharacters
- Single-Character Escapes
- Multiple-Character Escapes
- Character Groups
- Letters
- Marks
- Numbers
- Punctuation
- Separators
- Symbols
- Everything Else
- Block Escapes
- F. XSLT Formatting Codes
- Formatting Codes for Numbers
- Parts of Numbers
- Parts of Decimal Formats
- Formatting Codes for Dates and Times
- Parts of Dates and Times
- Presentation Modifiers
- Calendars
- Formatting Codes for Numbers
- G. XSLT 2.0 Migration Guide
- Powerful New Features in XSLT 2.0 and XPath 2.0
- Recursion Isnt Necessary Nearly as Often
- Grouping Is Much, Much Easier
- Datatypes and XML Schemas Are Supported
- Regular Expressions Are Supported
- Potential Errors
- Passing Undefined Parameters with <xsl:call-template> Causes an Error
- Math Works Differently in Some Cases
- Type Checking Is Much Stricter
- Calling Some Functions with More Than One Node Causes an Error
- Approaches to Migration
- Write (or Rewrite) Your Stylesheets from Scratch
- Change the Version to 2.0 and See What Happens
- Replace Awkward XSLT 1.0 Code with XSLT 2.0 Features
- Mix XSLT 1.0 and XSLT 2.0 in the Same Stylesheet
- Dont Migrate at All
- Powerful New Features in XSLT 2.0 and XPath 2.0
- Glossary
- Index
- Colophon
- SPECIAL OFFER: Upgrade this ebook with OReilly