|
Subject: [xsl] resolving variables out of context? From: James Cummings <James.Cummings@xxxxxxxxx> Date: Tue, 11 Sep 2001 14:46:26 +0100 (BST) |
Hiya XSL-List members,
If I have a template match like:
<xsl:template match="//xptr">
<xsl:variable name="doc" select="concat(../@src, '.xml')"/>
<xsl:variable name="fromID select="concat('B.', ../@src, '.', substring-before(substring-after(@from, 'ID('), ')'))"/>
<xsl:if test="@to">
<xsl:variable name="toID" select="concat('B.', ../@src, '.', substring-before(substring-after(@to, 'ID('), ')'))"/>
</xsl:if>
<xsl:value-of select="$doc"/>
<xsl:value-of select="$from"/>
<!-- The above two work -->
<xsl:value-of select="$toID"/>
<!-- But this one does not -->
</xsl:template>
Is the $toID limited to use *only* within the <xsl:if>? Is
there any way to declare it so that it can be used anywhere
within the <xsl:template match="//xptr"> as a whole? (I.e.
I don't want to for the whole document, as it changes each
time an <xptr> is matched.)
What I want to acheive is the setting of the variables once
at the beginning of the template, and then have access to
them from within nested <xsl:when> statements, rather than
declaring said variable again and again and again for all
the different possibilities. Any suggestions?
-James
--
James Cummings, James.Cummings@xxxxxxxxx, http://www.uea.ac.uk/~q503
Cursus Project, School of Music, University of East Anglia,
Norwich, Norfolk, NR4 7TJ, UK
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] using position() with XPa, Michael Kay | Thread | RE: [xsl] resolving variables out o, Michael Kay |
| [xsl] using position() with XPath, Michael Sobczak | Date | RE: [xsl] Suggestions to use Transf, Michael Kay |
| Month |