XPath: Navigating XML with XPath 1.0 and 2.0 Kick Start

Book description

XPath is to XML as SQL is to databases: XML applications need XPath to locate specific data within an XML document for further processing with other XML applications such as XSLT, XQuery, XPointer, XLink and DOM level 3. With XPath, these applications offer developers a full toolkit for transforming, linking, and searching XML data. Developers need to understand XPath to fully exploit XML in their applications, and they have few resources beyond the W3C specification. XPath Kick Start will examine every aspect of XPath in detail, including its influence on and use with these other XML standards.

With each technique illustrated with real-world examples, the book starts with coverage of the essentials of XPath, including nodes, expressions, functions and operators. The second half of the book details XPath in practice - from manipulating XML data to transforming, linking and querying XML documents.

Table of contents

  1. Copyright
    1. Dedication
  2. About the Author
  3. Acknowledgments
  4. We Want to Hear from You!
  5. Foreword
  6. Introduction
    1. What's in This Book?
    2. Who This Book Is For
    3. Conventions Used in This Book
    4. Source Code
  7. 1. Essential XPath
    1. Why XPath?
    2. XPath in Overview
      1. XPath 1.0
      2. XPath 2.0
    3. XPath Basics
    4. Introducing Location Paths
    5. XPath at Work
      1. The XPath Visualiser
      2. The Interactive Expression Builder
      3. XPath and .NET
      4. The XPath Explorer
      5. The XPath Tester
      6. The Xalan XPath Application
    6. XPath with XSLT
      1. Creating a Template
      2. The xsl:apply-templates Element
      3. Getting the Value of Nodes with xsl:value-of
      4. Working with Attributes
    7. XPath with XQuery
    8. XPath with XPointer and XLink
    9. XPath Resources
    10. In Brief
  8. 2. The XPath Data Model
    1. Understanding the XPath 1.0 Data Types
      1. Numbers
      2. Strings
      3. Booleans
      4. Node-Sets
    2. Understanding Nodes
      1. XPath Node Types
      2. The Root Node
      3. Element Nodes
      4. Attribute Nodes
      5. Processing Instruction Nodes
      6. Comment Nodes
      7. Text Nodes
      8. Namespace Nodes
    3. Node Names
    4. Node String Values
    5. Document Order
    6. Working with Node-Sets
      1. String Value of Node-Sets
    7. XPath Node Trees
    8. XPath and XML Infosets
    9. DOM Level 3 XPath
    10. In Brief
  9. 3. Location Steps and Paths
    1. Understanding Location Steps and Paths
      1. The Parts of a Location Step
      2. XPath Axes
      3. XPath Node Tests
      4. XPath Predicates
      5. Some Examples of XPath Location Paths
      6. Using XPath Abbreviated Syntax
    2. Using the XPath Axes
      1. Using the ancestor Axis
      2. Using the ancestor-or-self Axis
      3. Using the descendant Axis
      4. Using the descendant-or-self Axis
      5. Using the following Axis
      6. Using the following-sibling Axis
      7. Using the namespace Axis
      8. Using the parent Axis
      9. Using the preceding Axis
      10. Using the preceding-sibling Axis
      11. Using the self Axis
    3. Creating Compound Location Paths
      1. Nesting Predicates
      2. Using Predicates Without Operators
    4. In Brief
  10. 4. XPath 1.0 Functions and Operators
    1. The XPath Boolean Operators and Functions
      1. The boolean Function
      2. The false Function
      3. The lang Function
      4. The not Function
      5. The true() Function
    2. The XPath Numeric Operators and Functions
      1. The ceiling Function
      2. The floor Function
      3. The number Function
      4. The round Function
      5. The sum Function
    3. The XPath String Operators and Functions
      1. The concat Function
      2. The contains Function
      3. The normalize-space Function
      4. The starts-with Function
      5. The string Function
      6. The string-length Function
      7. The substring Function
      8. The substring-after Function
      9. The substring-before Function
      10. The translate Function
    4. The XPath Node-Set Operators and Functions
      1. The count Function
      2. The id Function
      3. The last Function
      4. The local-name Function
      5. The name Function
      6. The namespace-uri Function
      7. The position Function
    5. In Brief
  11. 5. XPath with XSLT
    1. Working with XSLT
    2. Techniques for Performing XSLT Transformations
    3. Creating Stylesheets
      1. Creating Templates
      2. Applying Templates for Child Nodes
      3. Using <xsl:value-of>
      4. Using <xsl:for-each>
    4. Understanding the match and select Attributes
    5. Copying Nodes
      1. Using the <xsl:copy> Element
      2. The <xsl:copy-of> Element
    6. Handling Whitespace
    7. Making Choices with <xsl:if> and <xsl:choose>
    8. Understanding the Default Template Rules
    9. Displaying Messages While Processing XSLT Stylesheets
    10. Setting Output Document Type
    11. In Brief
  12. 6. XPath with XPointer, XLink, and XQuery
    1. Data Access Using XPath
    2. Introducing XLinks
      1. Using XLink Attributes
      2. Using the xlink:type Attribute
      3. Using the xlink:show Attribute
      4. Using the xlink:actuate Attribute
      5. Using the xlink:href Attribute
    3. Introducing XPointers
      1. Using Barenames
      2. Using the Element Scheme
      3. Using the Namespace Scheme
      4. Using the General XPointer Scheme
        1. Creating XPointer Points
        2. Creating XPointer Ranges
    4. Introducing XQuery
    5. In Brief
  13. 7. Introducing XPath 2.0
    1. What's New in XPath 2.0?
      1. Handling Nodes
      2. Handling Data Types
      3. Working with Sequences
      4. The for Expression
      5. The if Expression
      6. The some and every Expressions
      7. Unions, Intersections, and Differences
      8. Comments
    2. Creating Some XPath 2.0 Examples
    3. Understanding the XPath Data Model
      1. Document Nodes
      2. Element Nodes
      3. Attribute Nodes
      4. Namespace Nodes
      5. Processing Instruction Nodes
      6. Comment Nodes
      7. Text Nodes
      8. Atomic Values
    4. In Brief
  14. 8. XPath 2.0 Expressions and Operators
    1. Creating Primary Expressions
      1. Literals
      2. Variables
      3. Parenthesized Expressions
      4. Function Calls
      5. Context Item Expressions
    2. Creating Arithmetic Expressions
    3. Creating Path Expressions
      1. XPath 2.0 Axes
      2. XPath 2.0 Node Tests
      3. XPath 2.0 Predicates
      4. XPath 2.0 Abbreviated Syntax
    4. Creating Sequence Expressions
      1. Creating Sequences
      2. Combining Sequences
        1. The union Operator
        2. The intersect Operator
        3. The except Operator
    5. Creating Comparison Expressions
      1. Value Comparisons
      2. General Comparisons
      3. Node Comparisons
      4. Order Comparisons
    6. Creating Logical Expressions
    7. Creating for Expressions
    8. Creating Conditional Expressions
    9. Creating Quantified Expressions
      1. Using the some Expression
      2. Using the every Keyword
    10. Creating Expressions That Work on Types
      1. instance of
      2. cast
      3. castable
      4. treat
    11. In Brief
  15. 9. The XPath 2.0 Numeric, Constructor, and Context Functions
    1. Introducing the XPath 2.0 Functions
      1. Function Namespaces
    2. Using Accessor Functions
      1. The fn:node-name Function
      2. The fn:string Function
      3. The fn:data Function
      4. The fn:base-uri Function
      5. The fn:document-uri Function
    3. Using the fn:error Function
      1. Constructor Functions
    4. Using Context Functions
      1. The fn:position Function
      2. The fn:last Function
      3. The fn:current-dateTime Function
      4. The fn:current-date Function
      5. The fn:current-time Function
    5. Using Numeric Functions
      1. The fn:floor Function
      2. The fn:ceiling Function
      3. The fn:round Function
      4. The fn:round-half-to-even Function
    6. In Brief
  16. 10. XPath 2.0 String Functions
    1. Working on Strings
      1. The fn:compare Function
      2. The fn:concat Function
      3. The fn:string-join Function
      4. The fn:starts-with Function
      5. The fn:ends-with Function
      6. The fn:contains Function
      7. The fn:substring Function
      8. The fn:string-length Function
      9. The fn:substring-before Function
      10. The fn:substring-after Function
      11. The fn:normalize-space Function
      12. The fn:normalize-unicode Function
      13. The fn:upper-case Function
      14. The fn:lower-case Function
      15. The fn:translate Function
      16. The fn:escape-uri Function
    2. Unicode Code Point Functions
      1. The fn:codepoints-to-string Function
      2. The fn:string-to-codepoints Function
    3. Using Pattern Matching
      1. Understanding Regular Expressions
      2. XPath 2.0 Versus XML Schema Difference
      3. The fn:matches Function
      4. The fn:replace Function
      5. The fn:tokenize Function
    4. In Brief
  17. 11. XPath 2.0 Boolean, QName, and Date Functions
    1. Boolean Functions
      1. The fn:true Function
      2. The fn:false Function
      3. The fn:not Function
    2. Functions That Work with Dates and Times
    3. Functions That Extract Data from Date/Time Values
      1. The fn:get-years-from-yearMonthDuration Function
      2. The fn:get-months-from-yearMonthDuration Function
      3. The fn:get-days-from-dayTimeDuration Function
      4. The fn:get-hours-from-dayTimeDuration Function
      5. The fn:get-minutes-from-dayTimeDuration Function
      6. The fn:get-seconds-from-dayTimeDuration Function
      7. The fn:get-year-from-dateTime Function
      8. The fn:get-month-from-dateTime Function
      9. The fn:get-day-from-dateTime Function
      10. The fn:get-hours-from-dateTime Function
      11. The fn:get-minutes-from-dateTime Function
      12. The fn:get-seconds-from-dateTime Function
      13. The fn:get-timezone-from-dateTime Function
      14. The fn:get-year-from-date Function
      15. The fn:get-month-from-date Function
      16. The fn:get-day-from-date Function
      17. The fn:get-timezone-from-date Function
      18. The fn:get-hours-from-time Function
      19. The fn:get-minutes-from-time Function
      20. The fn:get-seconds-from-time Function
      21. The fn:get-timezone-from-time Function
    4. Functions That Adjust Time Zones
      1. The fn:adjust-dateTime-to-timezone Function
      2. The fn:adjust-date-to-timezone Function
      3. The fn:adjust-time-to-timezone Function
    5. Subtracting xs:dateTime Values
      1. The fn:subtract-dateTimes-yielding-yearMonthDuration Function
      2. The fn:subtract-dateTimes-yielding-dayTimeDuration Function
    6. Functions That Work with QNames
      1. The fn:resolve-QName Function
      2. The fn:expanded-QName Function
      3. The fn:get-local-name-from-QName Function
      4. The fn:get-namespace-uri-from-QName Function
      5. The fn:get-namespace-uri-for-prefix Function
      6. The fn:get-in-scope-prefixes Function
    7. In Brief
  18. 12. XPath 2.0 Node and Sequence Functions
    1. Using Node Functions
      1. The fn:name Function
      2. The fn:local-name Function
      3. The fn:namespace-uri Function
      4. The fn:number Function
      5. The fn:lang Function
      6. The fn:root Function
    2. The XPath 2.0 Sequence Functions
      1. The fn:zero-or-one Function
      2. The fn:one-or-more Function
      3. The fn:exactly-one Function
      4. The fn:boolean Function
      5. The fn:index-of Function
      6. The fn:empty Function
      7. The fn:exists Function
      8. The fn:distinct-values Function
      9. The fn:insert-before Function
      10. The fn:remove Function
      11. The fn:subsequence Function
      12. The fn:unordered Function
      13. The fn:deep-equal Function
      14. The fn:count Function
      15. The fn:avg Function
      16. The fn:max Function
      17. The fn:min Function
      18. The fn:sum Function
      19. The fn:id Function
      20. The fn:idref Function
      21. The fn:doc Function
      22. The fn:collection Function
    3. In Brief

Product information

  • Title: XPath: Navigating XML with XPath 1.0 and 2.0 Kick Start
  • Author(s): Steven Holzner
  • Release date: December 2003
  • Publisher(s): Sams
  • ISBN: None