|
Subject: Re: [xsl] Is recursion in XSL really this difficult? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 17 Jul 2001 17:15:50 -0400 |
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><!-- The 'segmentfunc' named template returns, for a given node,
a text string with all occurrences of a given substring
isolated by markup. The substring to be isolated must be
passed to the template as the 'find' parameter: its markup
is provided by another named template, 'displayfound' (to
be provided in the main stylesheet).<xsl:template name="segmentfunc">
<xsl:param name="procstring">
<!-- the string to be processed. Trimmed recursively until
all occurrences have been isolated and passed to
'display'. -->
<xsl:value-of select="."/>
</xsl:param>
<xsl:choose>
<xsl:when test="$find and contains($procstring, $find)">
<xsl:value-of select="substring-before($procstring, $find)"/>
<xsl:call-template name="displayfound"/>
<xsl:call-template name="segmentfunc">
<xsl:with-param name="procstring"
select="substring-after($procstring, $find)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$procstring"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template name="displayfound">
<!-- Providing markup for the found string. -->
<xsl:param name="displaystring"/>
<b>
<xsl:value-of select="$find"/>
</b>
</xsl:template>
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Is recursion in XSL reall, Thomas B. Passin | Thread | RE: [xsl] Is recursion in XSL reall, Michael Kay |
| Re: [xsl] add variables, Frank Chen | Date | Re: [xsl] add variables, Wendell Piez |
| Month |