[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Rephrasing the problem [was Re: Second try: Search

Subject: Re: Rephrasing the problem [was Re: Second try: Search and replace many strings that may not be present in target
From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx>
Date: Mon, 20 May 2002 13:19:11 -0600
rephrasing of otherwise
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.