RE: [xsl] Evaluating last 3 or 4 characters of URL?

Subject: RE: [xsl] Evaluating last 3 or 4 characters of URL?
From: "Hemi Kara" <hemi@xxxxxxxxxxxxx>
Date: Mon, 12 May 2003 15:06:45 +1200
We have created code that searches for a file extension and outputs it
approriately according to that file extension

1) What we do, is create a variable,

2) In this case called "fileExtension"

3) We then take the value of the @url, find all characters after the ".",
this will give you the file extension.
	<xsl:variable name="fileExtension"
select="substring-after(string(@url),'.')" />

4) You can then use a number of tests on that variable

Hope this helps: Hemi Kara

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of David Pratt
Sent: Monday, 12 May 2003 2:09 p.m.
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] Evaluating last 3 or 4 characters of URL?

I am trying to evaluate the last 3 or 4 characters of a URL
so that I can add javascript in the href attribute.

It is not liking the {@url}.  Is this not just the string value
of the url attribute? Help on the syntax appreciated.

         <xsl:attribute name="id">
           <xsl:value-of select="@id"/>
       <xsl:attribute name="href">
			<xsl:when test="substring({@url}, -4, 4)!='.html'">
			  javascript: do_windowopen('
			    <xsl:value-of select="@url"/>
			<xsl:when test="substring({@url}, -3, 3)!='.htm'">
			  javascript: do_windowopen('
				<xsl:value-of select="@url"/>
               <xsl:value-of select="@url"/>

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread