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

RE: String comparison

Subject: RE: String comparison
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 4 Sep 2002 09:21:36 +0100
js string compare
You are using Microsoft's old proprietary WD-xsl language, so you won't
be able to use XSLT constructs like starts-with() and contains() until
you upgrade to XSLT 1.0.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Dineen, Geoffrey
> Sent: 04 September 2002 05:01
> To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
> Subject:  String comparison
> 
> 
> Hi
> 
> I have the following section of XML which I am parsing using 
> the XSL included below it.  At the position marked "### 
> conditional test here! ###" I am wanting to do a simple test 
> where I examine the current URL from the "for-each select" 
> statement to see if it contains the string "http://".  If it 
> does, the target of the resulting HTML HREF should be "_top" 
> causing the page to load in the entire browser window.  If 
> the URL does not contain the "http://" string the page should 
> be loaded in the "ESRCanvas" frame as is currently happening.
> 
> I'm just starting to learn the XSLT language, but presume I 
> need to use a "choose .... otherwise" statement to get this 
> test to work.  I am, however, not so sure on how I do the 
> match between the current URL and the string "http://".  I 
> have experimented with the contains() and starts-with() tests 
> but so far without much success.  Perhaps I am not using the 
> correct stylesheet version ?
> 
> I do not quite know where I am going here so would greatly 
> appreciate some help.
> 
> TIA
> Geoff
> 
> <?xml version="1.0"?>
> <?xml:stylesheet type="text/xsl" href="menus.xsl"?>
> 
> <TOPICLIST TYPE="ESR Intranet">
>    <TOPICS TYPE="ESR">
>       <TOPIC>
>          <TITLE>Home</TITLE>
>          <URL>/default.asp</URL>
>       </TOPIC>
>     </TOPICS>
>     <TOPICS TYPE="Databases &amp; Services">
>       <TOPIC>
>          <TITLE>Staff Directory</TITLE>
>  
> <URL>http://intranet/cgi-bin/gateway.exe?displayform=update/ma
> nixsue</URL>
>       </TOPIC>
>     </TOPICS>
> </TOPICLIST>
> 
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
> 
> <!-- MENUS.XSL -->
> 
> <xsl:template match="/">
>     <TITLE><xsl:value-of select="TOPICLIST/@TYPE" /></TITLE>
>     <LINK REL="stylesheet" TYPE="text/css" 
> HREF="/ESRscripts/menus.css" />
>     <SCRIPT LANGUAGE="JScript" SRC="/ESRscripts/menus.js"></SCRIPT>
> 
>     <!-- BUILD MENUBAR -->
> 
>     <DIV ID="divMenuBar">
>     <TABLE ID="tblMenuBar" BORDER="0">
>     <TR height="50%">
> 	
>     <xsl:for-each select="//TOPICS[TOPIC]">
>         <TD CLASS="clsMenuBarItem" VALIGN="BOTTOM">
>             <xsl:attribute name="ID">tdMenuBarItem<xsl:value-of
> select="@TYPE" /></xsl:attribute>
> 	<A CLASS="clsTopLevelLink"><xsl:attribute 
> name="HREF"><xsl:value-of select="@TURL" 
> /></xsl:attribute><xsl:value-of select="@TYPE" /></A> 
>         </TD>
>         <xsl:if test="context()[not(end())]">
>         <TD VALIGN="BOTTOM">|</TD>
>         </xsl:if>
>     </xsl:for-each>
> 	
>     </TR>
>     </TABLE>
>     </DIV>
> 		
>     <!-- BUILD INDIVIDUAL MENUS -->
> 	
>     <xsl:for-each select="//TOPICS[TOPIC]">
>         <DIV CLASS="clsMenu" Left="0">
>         <xsl:attribute name="ID">divMenu<xsl:value-of 
> select="@TYPE" /></xsl:attribute>
> 	<DIV CLASS="clsMenuSpacer"></DIV>
> 	<xsl:for-each select="TOPIC">
> 	<DIV>
> 
> 	### conditional test here! ###
> 
> 	<A TARGET="ESRCanvas">
> 	    <xsl:attribute name="HREF"><xsl:value-of 
> select="URL" /></xsl:attribute>
> 	    <xsl:value-of select="TITLE" />
> 	</A>
> 	</DIV>
>         </xsl:for-each>
>         </DIV>
>     </xsl:for-each>
> 	
> </xsl:template>
> 
> </xsl:stylesheet>
> 
>  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.