When it's an XSLT pattern, that's when.
As an XPath
para[@ref]selects, for a given node, its child
paraelements which have
refattributes. As an XSLT pattern it tests whether a given node is a
paraelement which has a
Similarly, something like
chapter/paratests whether a given node is a
paraelement with a
chapterelement parent. In XPath terms, you'd express it as something like
Aside from this sematic difference, syntactically XSLT patterns are an XPath subset. I don't have these things evaluating yet but, thanks to the miracle that is Boost::Spirit, I've extended Arabica::XPath to parse them. Took about half an hour, including writing a pile of test cases and getting them passing. It really is a top piece of work. While it's not hard to find people rambling on about how Python or Lisp or whatever really is the thing for writing little domain specific languages, this kind of thing really shows just how deadly cool template metaprogramming can be. Read the EBNF, transcribe it into code, compile, and go. Easy, expressive and type-safe. What more could you want?