This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Rephrasing the problem [was Re: Second try: Search and replace many strings that may not be present in target
Zack,
I figured it out just after sending... I was calling substring-before()
and substring-after(), both of which convert a node to a string. An
alternate (and more successful) way of doing what you want is to use d-o-e
and CDATA sections, though it makes many XSLT'ers blood boil. Remember
that d-o-e is not a mandatory option for an XSLT engine.
<xsl:template name="linkify">
<xsl:param name="contents" select="/.."/>
<xsl:param name="quote-names" select="/.."/>
<xsl:choose>
<xsl:when test="not($quote-names)">
<xsl:value-of select="$contents" disable-output-escaping="yes"/>
</xsl:when>
<xsl:when test="contains($contents, $quote-names[1]/@who)">
<xsl:call-template name="linkify">
<xsl:with-param name="contents">
<xsl:value-of select="substring-before($contents,
$quote-names[1]/@who)" disable-output-escaping="yes"/>
<xsl:value-of select="$quote-names[1]/@who"/>
<xsl:text disable-output-escaping="yes"><![CDATA[ [<a
href="people/]]></xsl:text>
<xsl:value-of select="translate($quote-names[1]/@who, ' ', '_')"/>
<xsl:text
disable-output-escaping="yes"><![CDATA[.html">*</a>]]]></xsl:text>
<xsl:value-of select="substring-after($contents,
$quote-names[1]/@who)" disable-output-escaping="yes"/>
</xsl:with-param>
<xsl:with-param name="quote-names"
select="$quote-names[position() > 1]"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="linkify">
<xsl:with-param name="contents" select="$contents"/>
<xsl:with-param name="quote-names"
select="$quote-names[position() > 1]"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Greg Faron
Integre Technical Publishing Co.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list