The axis and the predicate are optional, but the node test is required. If you don’t specify the axis, it defaults to child (children of the current node). If
you don’t specify the predicate, all nodes matching the node test are processed.
The axis is the direction to look. If the first character is a slash, this is relative to the root. If the first character is anything else, the axis is relative to the current
node, which may or may not be the root.
Two adjacent slashes mean descendants-or-self axis. In addition, it supports a special meaning when it appears at the start of an XPath expression. In
that location, it means any descendent of the root element, not the current context.
You can combine multiple predicates. The results are the intersection of the resulting set. Stated differently, that's all the nodes that satisfy both criteria.
The following examples are synonymous and return the women in the family that have names longer than five characters:
Using and is documented as being faster than sequential predicates with the Microsoft XML Core Services (MSXML 4.0).
The limit to the complexity you can use within XPath is what you and followon programmers will understand (although I'm sure there's a length limit,
I haven't run into it yet).
A union includes all nodes of the first clause combined with all nodes of the second.
Code generation is about building these once and reusing them many, many times—within and between applications.
I haven't been excited about using code generation supplied with frameworks and templates because they couldn't provide the control and
flexibility I demanded.
I felt like I was in a whitewater rapid without a paddle, rushing along quickly but quite uncertain which boulder I might hit.
The point here isn't whether stored procedures or dynamic SQL is a better approach but that critical decisions such as this should be made by your own organization, not a vendor.
A number of recent developments, including XML support, inheritance features in .NET, XSL Transformations (XSLT) processing, and wide-scale pattern recognition, make the time ripe for code generation to become part of your development process.