On 03.06.06 12:59:10, Stefan Behnel wrote:
Andreas Pakulat wrote:
Now the question is: Can I assume that the last step either contains text() or attribute::<attribute name> or @attrname?
You mean as the result of an XPath expression?
I mean if the result of an XPath is a list of strings, can I assume that this was created by either a ::text() or an attribute:: expression.
Well, you may get back bool values or generated strings (can you?), in which case you can't expect to find out what node (or nodes) they came from.
Well, for bool values you cannot get at the "matched" nodes anyway and it doesn't make sense for that, I think. The same is true AFAIK for generated strings.
The evaluator can only highlight tree nodes that are part of the result of an XPath expression, it will probably show the result in cases of generated strings or bools but it cannot display any tree node for there anyway.
Also, AFAIR, you can merge multiple XPath expressions into one and that case may be hard to detect. The last part of an XPath expression is not always what returned the result...
Hmm, could you give me an example for something like that? I'm not that familiar with XPath...
The only problem I see is that I need to traverse the text-childs of the elements returned when the XPath selects text nodes to know which strings belong to which elements.
Note that you can get back a wild combination of strings, nodes and numbers, so there is a bit of work to do anyway.
Ah, I didn't see "|" until now. Well, that makes the whole thing a bit "harder", because I can't tell wether a given string is created from a text node or is the value of an attribute.
I'm thinking, maybe I should just highlight the element for any text returned (regardless wether it is from an attribute or a text node) and not the try to find the proper attribute or text... After all you can easily see the attributes and text of the element.
Are there other ways to get at text() or attribute nodes?
What do you mean?
I mean, is there another way to have the text node of an element as result of the xpath expression, other than having the text() function somewhere (probably at the end of the path)? The same for attributes, is there another way to get the values of attributes in the result, other than using attribuge::(*|<name>) or using @<name>?