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 May 7, 2002 | 09:47 AM
  #1  
TopBanana's Avatar
TopBanana
Thread Starter
Scooby Regular
 
Joined: Jan 2001
Posts: 9,781
Likes: 0
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?
Reply
Old May 7, 2002 | 10:20 AM
  #2  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
Post

Are you using XML::XPath under Perl?

Steve.
Reply
Old May 7, 2002 | 10:44 AM
  #3  
TopBanana's Avatar
TopBanana
Thread Starter
Scooby Regular
 
Joined: Jan 2001
Posts: 9,781
Likes: 0
Post

No - I'm doing a transformation using the DOM
Reply
Old May 7, 2002 | 10:47 AM
  #4  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
Post

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

I don't see how the language makes any odds? I need an XPath solution
Reply
Old May 7, 2002 | 12:26 PM
  #6  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
Post

It makes all the difference because while the API may be the same, the way you actually use it will differ.
Reply
Old May 7, 2002 | 01:08 PM
  #7  
TopBanana's Avatar
TopBanana
Thread Starter
Scooby Regular
 
Joined: Jan 2001
Posts: 9,781
Likes: 0
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
Reply
Old May 7, 2002 | 01:14 PM
  #8  
stevencotton's Avatar
stevencotton
Scooby Regular
 
Joined: Jan 2001
Posts: 2,710
Likes: 1
From: behind twin turbos
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.
Reply
Old May 7, 2002 | 01:31 PM
  #9  
TopBanana's Avatar
TopBanana
Thread Starter
Scooby Regular
 
Joined: Jan 2001
Posts: 9,781
Likes: 0
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
Reply
Old May 7, 2002 | 03:45 PM
  #10  
TopBanana's Avatar
TopBanana
Thread Starter
Scooby Regular
 
Joined: Jan 2001
Posts: 9,781
Likes: 0
Thumbs up

WHO DA MAN!!!

(Now why didn't I think of that?!)
Reply
Old Jul 5, 2002 | 03:31 PM
  #11  
netclectic2's Avatar
netclectic2
Scooby Regular
 
Joined: Mar 2001
Posts: 218
Likes: 0
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]
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
g.huggins
Wanted
2
Jul 3, 2003 05:36 PM
simo
Wanted
3
Nov 7, 2002 02:40 PM
TopBanana
Computer & Technology Related
1
Oct 30, 2002 03:29 PM




All times are GMT +1. The time now is 10:39 AM.