xsl-list
[Top] [All Lists]

RE: How to Tag Several Words in a Given String

2005-10-14 02:06:25
This did it! :D thanks a lot sir!

--- Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:


<xsl:function name="f:replace-all">
  <xsl:param name="input" as="xs:string"/>
  <xsl:param name="words-to-replace"
as="xs:string*"/>
  <xsl:param name="replacement" as="xs:string"/>
  <xsl:sequence select="if
(exists($words-to-replace))
          then f:replace-all(replace($in,
$words-to-replace, 
$replacement))
          else $input"/>
</xsl:function>


I made the mistake of tidying the code just before
posting it and messed it
up. What I meant to say was:

<xsl:function name="f:replace-all">
  <xsl:param name="input" as="xs:string"/>
  <xsl:param name="words-to-replace"
as="xs:string*"/>
  <xsl:param name="replacement" as="xs:string"/>
  <xsl:sequence select="if
(exists($words-to-replace))
          then f:replace-all(replace($in,
$words-to-replace[1],
$replacement),
                            
remove($words-to-replace,1),
                             $replacement)
          else $input"/>
</xsl:function>

Michael Kay
http://www.saxonica.com




--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





                
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--