2 The problem is more with how you select the nodes, `name()` will give you the name including the prefix, so you don't need to specify this as a separate part of the query (I think as it's the default prefix it is blank). So the value will be `AUTHOR1` etc. So change the way that you select the author nodes to just use `/*[starts-with(name(), 'AUTHOR')]`...
1 I really like Hamze GhaemPanah's [answer](/php?q=1071#a1290) for its brevity. However, there's a small bug in it.
0 If your needle will always be 1 character, use Galled's answer, it's going to be faster by quite a bit. If your $needle is a string, try this. Seems to work fine.