Print

Print


On Fri, 13 Feb 2004 09:04:36 -0500, David Sewell wrote:

> So that means that to return "letter" nodes across those publications
> we'd need to use XPath like
>
>   (//div1|//div2|//div3|//div4)[@type="letter"]
>
> which is ugly as sin. (And what if a new publication goes to div5?)
> Or we could be lazy and wildcard:
>
>   //*[@type="letter"]
>
> which could be very bad if anything other than a <divN> element
> had a @type of "letter".

Does it matter that an expression is "ugly" if it works? Another
possibiliy for matching any possible numbered div when it is a
letter, while avoiding letters that are encoded as something else:

    //*[starts-with(name(),'div')][@type='letter']


// Gregory Murphy. Isopaleocopria.