|
Subject: [xsl] Contains(@href. '/') returns false From: "NILESH PATEL" <jayganesh786@xxxxxxxxxxx> Date: Fri, 08 Mar 2002 11:31:44 +0000 |
********** 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: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>
************* 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.
_________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Re: RE: RFC XSLT Standard - ", Dimitre Novatchev | Thread | Re: [xsl] Contains(@href. '/') retu, Jeni Tennison |
| RE: [xsl] How to get the value sele, Bryan Rasmussen | Date | Re: [xsl] Contains(@href. '/') retu, Jeni Tennison |
| Month |