DOM XPath pattern matching

H

Hardy Merrill

I have an XML document that has this structure:

<applications>
<application>
<app_name>ABC</app_name>
</application>
<application>
<app_name>DEF</app_name>
</application>
</applications>

I'm wondering if there's a way using XPath and some pattern to find
case *insensitive* matches for a particular app_name??

For example, if I have app_name 'ABC' and I want to determine if there
are any existing nodes that have app_names like 'ABC', or 'Abc', or
'abc', or 'aBC', etc. Is there some version of 'selectSingleNode' with
a pattern that can do that? AFAICT there aren't any case
(in)sensitivity functions in XSL or XPath.

TIA.

Hardy Merrill
 
M

Martin Honnen

Hardy said:
I have an XML document that has this structure:

<applications>
<application>
<app_name>ABC</app_name>
</application>
<application>
<app_name>DEF</app_name>
</application>
</applications>

I'm wondering if there's a way using XPath and some pattern to find
case *insensitive* matches for a particular app_name??

For example, if I have app_name 'ABC' and I want to determine if there
are any existing nodes that have app_names like 'ABC', or 'Abc', or
'abc', or 'aBC', etc. Is there some version of 'selectSingleNode' with
a pattern that can do that? AFAICT there aren't any case
(in)sensitivity functions in XSL or XPath.


Use translate(element, 'ABCDEDFHIJKLMNOPQRESTUFWXYZ',
'abcdefghijklmnopqrestuvwxyz')
e.g.

/applications/application['abc' = translate(app_name, 'ABC', 'abc')]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top