Subject: Re: [xsl] Recursion not recursing, or not passing parameter. Multiple search/ replace. From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 17 Dec 2015 12:14:02 -0000 |
I am trying to write an XSLT stylesheet that does a multiple search and replace. In order to make it work with multiple search/replace string pairs I think I need to use recursion, calling the built-in replace function for each pair. However I don't seem to be getting the parameter set, or used, properly when I try to do the recursive call to do the next pair.
I set up the pairs in a sequence of elements as follows:
<xsl:variable name="replace-spec" > <replace source="smith_component" replacement="{$new-name}" />
<replace source="$ref-uuid-1" replacement="{$new-uuid-1}" /> <replace source="$ref-uuid-2" replacement="{$new-uuid-2}" />
</xsl:variable>
<xsl:variable name="replace-1" select="$replace-spec/replace[1]" />
<xsl:variable name="source-text" as="xs:string" select="$replace-1/@source <mailto:$replace-1/@source>" /> <xsl:variable name="replacement-text" as="xs:string" select="$replace-1/@replacement <mailto:$replace-1/@replacement>" />
<xsl:variable name="template-text-2" as="xs:string" select="replace( $source-string, $source-text, $replacement-text )" />
<xsl:variable name="replace-remainder" select="$replace-1/following-sibling::*" />
<xsl:choose> <xsl:when test="$replace-remainder" > <xsl:variable name="template-text-3" as="xs:string" select="my:replace-sequence( $template-text-2, $replace-remainder )" />
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Recursion not recursing, or n, Kerry, Richard richa | Thread | Re: [xsl] Recursion not recursing, , Kerry, Richard richa |
[xsl] Recursion not recursing, or n, Kerry, Richard richa | Date | Re: [xsl] Recursion not recursing, , David Carlisle d.p.c |
Month |