> Peter Hunsberger wrote:
> > Conal Tuohy <[EMAIL PROTECTED]> wrote:

> > string(/html/head/title[normalize-space()]|/html/body//h1[1])

> > The string() function returns the string value of the FIRST 
> > NODE in the resulting nodeset.
> 
> Ahh, that would do the trick.  I believe in some old implementations
> (Xerces/Xalan) I've run into that wasn't the case; I'm pretty 
> sure I've
> seen the union of the strings.
> 
> Might be a tad expensive, but most likely he can be more 
> specific on the
> path to the h1...

Yes. Though theoretically, the xpath intepreter should optimise the
expression and evaluate the right-hand side of the union operator only if
the left hand side is empty (like the "or" operator in Java "if"
statements). I don't know if this actually happens but it's an obvious and
probably rather easy optimisation to implement.

I tested the XPath expression in an XSLT stylesheet, but in the original
example Alfred was replacing the XPathDirectoryGenerator, which looks up an
XPath Component I believe ... if it turns out that the default xpath
implementation is sub-optimal (or even buggy) it could be worth putting the
effort in there. Alternatively, if it really is necessary to call back
another pipeline, what about using a generic transformer like the
XIncludeTransformer? 

Con

<<attachment: winmail.dat>>

Reply via email to