[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: matches() method in XPath 1.0
https://stackoverflow.com/a/11857166/36305 This XPath 2.0 expression: ends-with($s, $t) Has this equivalent in XPath 1.0: $t = substring($s, string-length($s) - string-length($t) +1) Thanks, Dimitre On Mon, Jan 30, 2023 at 3:30 PM Manuel Souto Pico terminolator@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > Dear all, > > I have a simple question, hopefully someone can help. > > Given some nodes like this: > > <text>Some text.</text> > <text>foo.svg</text> > > in XPath 2.0 I can match the ones (like the second) that contain a file > name with something like > > //text[matches(text(), '[^\s]*\.(svg|png|jpg)')] > > That should match the second text node, and not the first. > > I am looking for something to achieve the same purpose in XPath 1.0, even > if it's using something like ends-with instead of regex. > > Why XPath 1.0? I'd love to use version 2.0 but this is for using the ITS > data categories, which seem not to be compatible with XPath 2.0 > https://www.w3.org/TR/its20/#d0e2513 > > Could someone have an idea? > Thank you so much. > Cheers, Manuel > > PS: Apologies if questions about XPath are not appropriate in this list, > please let me know if that's the case. > XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> > EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/782854> (by > email <>) > -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- To avoid situations in which you might make mistakes may be the biggest mistake of all ------------------------------------ Quality means doing it right when no one is looking. ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play ------------------------------------- To achieve the impossible dream, try going to sleep. ------------------------------------- Facts do not cease to exist because they are ignored. ------------------------------------- Typing monkeys will write all Shakespeare's works in 200yrs.Will they write all patents, too? :) ------------------------------------- Sanity is madness put to good use. ------------------------------------- I finally figured out the only reason to be alive is to enjoy it.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|