[xsl] Closest matching value

Subject: [xsl] Closest matching value
From: "Stuart Robinson" <serob@xxxxxxxxxxx>
Date: Mon, 10 May 2004 20:48:57 +0100
Hello,

I've scoured the Web and these archives for a solution to this problem, all
to no avail I'm afraid.

My source dosument looks like this

<root>
 <domain>
  <url>http://localhost:8080/site1</url>
  <url>http://www.domain.com</url>
  <controller>members\www1\site1</controller>
 </domain>
 <domain>
  <url>http://localhost:8080/site2</url>
  <controller>members\www2\site2</controller>
 </domain>
 <domain>
  <url>http://localhost:8080/site2/folder1</url>
  <controller>members\www3</controller>
 </domain>
</root>

My xsl doc contains a variable holding the Request URI. I want to select the
controller in the domain which contains the closest matching url value (url
values are unique) for the Request URI.

For example,

If RequestURI = http://localhost:8080/site2/folder1/page/page/page)
Then controller = members\www3.

If RequestURI = http://localhost:8080/site2)
Then controller = members\www2\site2

etc....

Thanks for reading, any help would be very much appreciated.


Stuart

Current Thread