Is there an “elegant” way to test that an attribute value starts with a letter?

Use : not(number(substring(@value,1,1)) = number(substring(@value,1,1)) ) Or use : not(contains('0123456789', substring(@value,1,1))) Finally, this may be the shortest XPath 1.0 expression to verify your condition : not(number(substring(@value, 1, 1)+1)).

Use: not(number(substring(@value,1,1)) = number(substring(@value,1,1)) ) Or use: not(contains('0123456789', substring(@value,1,1))) Finally, this may be the shortest XPath 1.0 expression to verify your condition: not(number(substring(@value, 1, 1)+1)).

Great answers - +1. The third and shortest way is a nice twist. Would never have thought of that.

– Jacqueline May 13 at 16:33 @Jacqueline: Yes, XPath is an amazing language and becomes even more so in version 2.0 and 3.0. – Dimitre Novatchev May 13 at 16:36.

It's a bit shorter, if not exactly elegant or obvious: The basic idea is to test whether the first character is a digit. The translate() call is needed because 0 and NaN both evaluate to false and we need 0 to be treated as true inside of the not() call.

1 for a great answer. And thanks for the info about '0' returning false. – Jacqueline May 13 at 16:31.

Use substring() to snag the first character from the @value value Use the number() function to evaluate that character If the character is a number, it will return a number If the character is not a number it will return NaN Use the string() function to evaluate that as a string and check to see if it is NaN or not.

1 Great answer: +1. And thanks for the walk-through of it. Very clear.

– Jacqueline May 13 at 16:34.

1"> Use the substring() function to snag the first character from the @value value Use the number() function to evaluate that character If the character is a number, it will return a number If the character is not a number it will return NaN Use string-length() to evaluate whether it was greater than 1 (not a number).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions