This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: resolving variables out of context?
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] resolving variables out of context?
- From: "Michael Kay" <mhkay at iclway dot co dot uk>
- Date: Tue, 11 Sep 2001 15:19:05 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
> <xsl:if test="@to">
> <xsl:variable name="toID" select="concat('B.', ../@src, '.',
> substring-before(substring-after(@to, 'ID('), ')'))"/>
> </xsl:if>
>
> Is the $toID limited to use *only* within the <xsl:if>?
yes.
> Is
> there any way to declare it so that it can be used anywhere
> within the <xsl:template match="//xptr"> as a whole?
>
Try:
<xsl:variable name="toID">
<xsl:if test="@to"><xsl:value-of select="concat('B.', ../@src, '.',
substring-before(substring-after(@to, 'ID('), ')'))"/>
</xsl:if>
</xsl:variable>
It's now a result tree fragment rather than a string, but you can use an RTF
to all intents and purposes as it it were a string.
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list