Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

XPath help req'd! Pattern-matching

Thread Tools
 
Search this Thread
 
Old 07 May 2002, 09:47 AM
  #1  
TopBanana
Scooby Regular
Thread Starter
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

I need to select all nodes whose name begins with 'PREMIUMCLASS-'. I can't seem to select 'PREMIUMCLASS-*' - there must be a way to do this surely?
Old 07 May 2002, 10:20 AM
  #2  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Are you using XML::XPath under Perl?

Steve.
Old 07 May 2002, 10:44 AM
  #3  
TopBanana
Scooby Regular
Thread Starter
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

No - I'm doing a transformation using the DOM
Old 07 May 2002, 10:47 AM
  #4  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Which language? Document Object Model is just an interface.
Old 07 May 2002, 12:03 PM
  #5  
TopBanana
Scooby Regular
Thread Starter
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

I don't see how the language makes any odds? I need an XPath solution
Old 07 May 2002, 12:26 PM
  #6  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

It makes all the difference because while the API may be the same, the way you actually use it will differ.
Old 07 May 2002, 01:08 PM
  #7  
TopBanana
Scooby Regular
Thread Starter
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Post

Hmm, I'm a little dubious be I'll give you the benefit of the doubt!

Using C# and the System.Xml namespace. I need the solution to work inside an XSL template though, with a for-each..

Cheers for yr help

Trending Topics

Old 07 May 2002, 01:14 PM
  #8  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

Unless you see a method that can do it for you you won't be able to do it with the API, which is why I asked which language; if you want to pattern match on nodes and the API doesn't afford you the luxury then the problem becomes language specific.

Does't matter, C# I can't help you with

Good luck,
Steve.
Old 07 May 2002, 01:31 PM
  #9  
TopBanana
Scooby Regular
Thread Starter
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Unhappy

I don't want to do it with the API though, just doing a straight XSLT transformation - it's the same on Java, C#, whatever! Looking for a means of doing the pattern matching using XPath - but it doesn't seem to work that way. Ah well....

Cheers
Old 07 May 2002, 03:45 PM
  #10  
TopBanana
Scooby Regular
Thread Starter
 
TopBanana's Avatar
 
Join Date: Jan 2001
Posts: 9,781
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

WHO DA MAN!!!

(Now why didn't I think of that?!)
Old 05 July 2002, 03:31 PM
  #11  
netclectic2
Scooby Regular
 
netclectic2's Avatar
 
Join Date: Mar 2001
Posts: 218
Likes: 0
Received 0 Likes on 0 Posts
Post

//*[starts-with(name(),'PREMIUMCLASS-')]

howzat!?

there are some good xpath examples here

xpathvisualizer is also a very handy tool.

[Edited by netclectic2 - 5/7/2002 3:33:09 PM]
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
g.huggins
Wanted
2
03 July 2003 05:36 PM
simo
Wanted
3
07 November 2002 02:40 PM
TopBanana
Computer & Technology Related
1
30 October 2002 03:29 PM



Quick Reply: XPath help req'd! Pattern-matching



All times are GMT +1. The time now is 07:26 PM.