Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
XML
data.xmlanalysis
mappoint.webservice
msf
msxml-webrelease
netmyservices.sdk
passport.sdk
soap
soapsdk
uddi.general
uddi.programming
uddi.specification
xml
xmlsqlwebrelease
xsl
  
 
date: Wed, 20 Aug 2008 16:57:40 -0700 (PDT),    group: microsoft.public.xsl        back       


Having problems String Matching   
<xsl:variable name="keyword_orig_start" select="'<b>'"/>
  <xsl:variable name="keyword_orig_end" select="'</b>'"/>

  <!-- *** Find and replace *** -->
  <xsl:template name="replace_string">
    <xsl:param name="find"/>
    <xsl:param name="replace"/>
    <xsl:param name="string"/>
    <xsl:choose>
      <xsl:when test="contains($string, $find)">
        <xsl:value-of select="substring-before($string, $find)"/>
        <xsl:value-of select="$replace"/>
        <xsl:call-template name="replace_string">
          <xsl:with-param name="find" select="$find"/>
          <xsl:with-param name="replace" select="$replace"/>
          <xsl:with-param name="string"
            select="substring-after($string, $find)"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$string"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


_____________________________________________________________________________


		<xsl:variable name="retro">
     			<xsl:call-template name="replace_string">
        		<xsl:with-param name="find" select="$keyword_orig_start"/>
        		<xsl:with-param name="replace" select="''"/>
        		<xsl:with-param name="string" select="T"/>
      			</xsl:call-template>
  		 </xsl:variable>

		<xsl:variable name="retro2">
     			 <xsl:call-template name="replace_string">
        		<xsl:with-param name="find" select="$keyword_orig_end"/>
        		<xsl:with-param name="replace" select="''"/>
        		<xsl:with-param name="string" select="$retro"/>
      			</xsl:call-template>
    		</xsl:variable>

	<xsl:value-of select="$retro2"/>
	<xsl:choose>

      <xsl:when test="retro2 = 'Google">
ETC..ETC...

When the Google search box searches for terms it will add a <b> </b>
tag to the keywords you searched for.  I need a way to match up on the
whole title.  I already wrote a two variables that take the <b> and </
b> out of the title results as listed above (retro, and retro2 being
the final product).  The problem is when i do the "when test" i dont
get any results, but if i just print out the value of retro2, it
prints out perfectly...

Not sure what i am doing wrong, any help would be wonderful.

Thanks!
date: Wed, 20 Aug 2008 16:57:40 -0700 (PDT)   author:   unknown

Re: Having problems String Matching   
hikaru@gmail.com wrote:

>         		<xsl:with-param name="string" select="T"/>

> When the Google search box searches for terms it will add a <b> </b>
> tag to the keywords you searched for.  I need a way to match up on the
> whole title.  I already wrote a two variables that take the <b> and </
> b> out of the title results as listed above (retro, and retro2 being
> the final product).  The problem is when i do the "when test" i dont
> get any results, but if i just print out the value of retro2, it
> prints out perfectly...
> 
> Not sure what i am doing wrong, any help would be wonderful.

You need to show us the XML input to that stylesheet so at least show us 
the 'T' element you have and pass in above.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
date: Thu, 21 Aug 2008 12:48:15 +0200   author:   Martin Honnen

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us