|
Subject: Re: [xsl] accessing previously created element From: Greg Faron <gfaron@xxxxxxxxxxxxxxxxxx> Date: Wed, 01 May 2002 13:52:55 -0600 |
unfortunately when transforming the i'th 'a' element to a 'b' (assume i > 1) I also need to access the (i-1)'th 'b' element; that is, the values used to create a 'b' element are dependent upon the current 'a' element being transformed and the preceding 'b' element. Is this possible? in a single pass?
<xsl:template name="b-from-a">
<xsl:param name="local-a" />
<xsl:choose>
<xsl:when test="not($local-a)">
<!-- Shouldn't be reached unless your initial call is bogus. -->
</xsl:when>
<xsl:when test="$local-a/preceding-sibling::a[1]">
<xsl:variable name="prev-b">
<xsl:call-template name="b-from-a">
<xsl:with-param select="$local-a/preceding-sibling::a[1]" />
</xsl:call-template>
</xsl:variable>
<!--
Use $local-a and $prev-b to construct "b"
-->
<xsl:value-of select="..." />
</xsl:when>
<xsl:otherwise>
<!--
First occurrence (i == 1)
Construct it however you normally do it.
-->
<xsl:value-of select="..." />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Greg Faron Integre Technical Publishing Co.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] accessing previously created , paul morgan | Thread | Re: [xsl] accessing previously crea, paul morgan |
| [xsl] data translation => descendan, Oliver Kurt | Date | [xsl] <xsl:for-each> help, Zoe |
| Month |