xsl-list
[Top] [All Lists]

Re: multiple template value input

2003-09-18 08:30:16


More than likely you would be "handing" them to a template, rather that
an "x-path function".  In any event, it would be best if you explained
what you want to accomplish.  It can probably be done better and more
easily in some other way, but we need more information.

Cheers,

Tom P

XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


....that's right: 

my task is as follows, fully explained:


this template gets the contents of an element which occur more than once:

<xsl:template match="INSTANCE" name="joseph">
   <xsl:for-each select="key('tracker', 'Referenced Document')">
        <xsl:copy-of
select="substring-before(substring-after(.,'&quot;\&quot;'), '&quot;')"/>
   </xsl:for-each>
</xsl:template>


i try to hand these over to a variable first:

<xsl:variable name="frank">
<xsl:call-template name="joseph">
</xsl:call-template>
</xsl:variable>

and finally i want to put in the variable in the following replace function,
which is within another template...:

<xsl:template match="ATTRIBUTE" name="koarl">
        <xsl:call-template name="replace-string">
            <xsl:with-param name="text" select="$frank"/>
            <xsl:with-param name="from" select="'\\'"/>
            <xsl:with-param name="to" select="'\'"/>
        </xsl:call-template>
    </xsl:template>
    <xsl:template name="replace-string">
        <xsl:param name="text"/>
        <xsl:param name="from"/>
        <xsl:param name="to"/>
        <xsl:choose>
            <xsl:when test="contains($text, $from)">
                <xsl:variable name="before" select="substring-before($text,
$from)"/>
                <xsl:variable name="after" select="substring-after($text,
$from)"/>
                <xsl:variable name="prefix" select="concat($before, $to)"/>
                <xsl:value-of select="$before"/>
                <xsl:value-of select="$to"/>
                <xsl:call-template name="replace-string">
                    <xsl:with-param name="text" select="$after"/>
                    <xsl:with-param name="from" select="$from"/>
                    <xsl:with-param name="to" select="$to"/>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$text"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

all of these work perfectly, except the variable "frank" that is put in as
the outcomes of all the for-each loops in the first template put together...


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>