• home
  • forum
  • my
  • kt
  • download
  • Pattern Matching

    Author: 2007-08-28 10:49:53 From:

    Patterns are simple XPath expressions evaluating to node-sets.

    A given node matches a given pattern if:

    the node is member of the result of evaluating the pattern with respect to some context.

    Operationally (and intuitively), a pattern matching is probably best evaluated backwards (from right to left).


    Recall the structure of XPath node-set expressions:

    pattern: location path | ... | location path
    location path:     /step/ ... // ... /step
    step: axis nodetest predicate

    • a pattern is a set of XPath location paths separated by | (union)
    • restrictions: only the child (default) and attribute (@) axes are allowed here
    • extensions: the location paths may start with id(..) or key(..)


    A simple example is:

    match="section/subsection | appendix//subsection"
    

    which matches subsection elements occurring either as child elements of section elements or as descendants of appendix elements.


    These figures illustrate the pattern matching mechanism.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Authoring (2)
      Book Samples (1)
      Database Related (2)
      Development (7)
      Introduction to XML (10)
      Java and XML (1)
      Miscellaneous (5)
      Parsing (2)
      PHP and XML (0)
      Style Sheets (8)
      Web Services (5)

    New

    Hot