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

Contains(@href. '/') returns false

Subject: Contains(@href. '/') returns false
From: "NILESH PATEL" <jayganesh786@xxxxxxxxxxx>
Date: Fri, 08 Mar 2002 11:31:44 +0000
contains href


Dear all,

Following the previous posting of recursive template to find file name from long file path, using following syntex, I get the full path in stead of expected filename only. Is it the bug somewhere?
***********
test.xml
************
<?xml version="1.0" encoding="UTF-8" ?>


<!-- Created by npatel on 08 March 2002, 09:06 -->

<test>
<test_string href="h:/rcs/product/src/software/xml/pml/unit_tests/xml_data/storage.xml#xpointer(//*)" />
</test>


**********
test.xsl
*********
<?xml version="1.0" encoding="UTF-8" ?>

<!--
   Document   : real_partitions.xsl
   Created on : 27 February 2002
   Author     : npatel
   Comment
       purpose of transformation follows.
-->

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:fo="http://www.w3.org/1999/XSL/Format">

		<xsl:template name="lastIndexOf">
  <!-- declare that it takes two parameters - the string and the char -->
  <xsl:param name="string" />
  <xsl:param name="char" />
  <xsl:choose>
     <!-- if the string contains the character... -->
     <xsl:when test="contains($string, $char)">
        <!-- call the template recursively... -->
        <xsl:call-template name="lastIndexOf">
           <!-- with the string being the string after the character
                -->
           <xsl:with-param name="string"
                           select="substring-after($string, $char)" />
           <!-- and the character being the same as before -->
           <xsl:with-param name="char" select="$char" />
        </xsl:call-template>


</xsl:when>
<!-- otherwise, return the value of the string -->
<xsl:otherwise><xsl:value-of select="concat($string, $char)"/> </xsl:otherwise>
</xsl:choose>


	 <!--xsl:value-of select="$string" /-->
</xsl:template>

   <xsl:template match="test">
			<html>
			<head>
				<title>Test of Strings</title>
			</head>
			<body>
			<xsl:for-each select="test_string">
				<xsl:variable name="file">
					<xsl:call-template name="lastIndexOf">
						<xsl:with-param name="string" select="substring-before(@href, '#')" />
							<xsl:with-param name="char" select="/" />
				</xsl:call-template>

				</xsl:variable>
				<xsl:value-of select="$file"/>

			</xsl:for-each>
			</body>
		</html>
 </xsl:template>

</xsl:stylesheet>

*************
test.html
*************
<html xmlns:fo="http://www.w3.org/1999/XSL/Format">
<head>
<title>Test of Strings</title>
</head>
<body>h:/rcs/product/src/software/xml/pml/unit_tests/xml_data/storage.xml

</body>
</html>

Following the syntax I should get only <body>storage.xml</body>
in output.

If anyone has faced the same situation then please respond.#

Thnaks

Nilesh

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


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.