xpathtcltdom

Does tDOM have the equivalent of the CSS ^= operator?


Is there a method of selecting elements with a class attribute that is similar to the [class^="nm_"] used in CSS? I'd like to return all the spans that have a class that begins with nm_. The ^= is not recognized in tDOM.

foreach item [$doc selectNodes {html/body/div[@class="main"]//span[@class^="nm_"]}] {

Thank you.


Solution

  • You need to use function starts-with:

    //span[starts-with(@class, "nm_")]