Re: [xsl] Placing mark-up in between strings

Subject: Re: [xsl] Placing mark-up in between strings
From: Jeff Sese <jsese@xxxxxxxxxxxx>
Date: Thu, 23 Nov 2006 18:07:39 +0800

I'm not sure but i think it has something to do with the ati:replace-with-nodes-1 function call in ati:replace-with-nodes. this should return a xs:string and not a node() as per requirement in the 1st parameter of ati:replace-with-nodes function.

i tried this inside the ati:replace-with-nodes-1 function:

<xsl:message terminate="yes">
   <xsl:value-of select="$input"/>
   <xsl:value-of select="$word-to-replace"/>
   <xsl:copy-of select="$replacement"/>

and got nothing... i really can't find the actual problem but i think it lies in the ati:replace-with-nodes-1 function.

-- jeff

Florent Georges wrote:
        <xsl:sequence select="
            if ( exists($words-to-replace) ) then
                      $input, $words-to-replace[1], $replacement[1]
                  remove($words-to-replace, 1),
                  remove($replacement, 1)
          Internal.  Coroutine for ati:replace-with-nodes().
          Treat a single replacement.
      <xsl:function name="ati:replace-with-nodes-1" as="node()*">
        <xsl:param name="input"           as="xs:string?"/>
        <xsl:param name="word-to-replace" as="xs:string"/>
        <xsl:param name="replacement"     as="node()"/>
        <xsl:variable name="before" select="
            substring-before($input, $word-to-replace)"/>
          <xsl:when test="exists($before)">
            <xsl:value-of select="$before"/>
            <xsl:sequence select="$replacement"/>
            <xsl:sequence select="
                    substring-after($input, $word-to-replace),
            <xsl:sequence select="$input"/>

Current Thread