[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Evaluating last 3 or 4 characters of URL?

Subject: Re: Evaluating last 3 or 4 characters of URL?
From: David Pratt <prattda@xxxxxxxxxxxxxxx>
Date: Sun, 11 May 2003 22:41:58 -0500
xsl value of url
Thanks Hemi. That's good advice.

On Sunday, May 11, 2003, at 10:06 PM, Hemi Kara wrote:


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:  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.

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


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.