Hi,
Backwards from Andrew's answer:
<input>
<!-- This is a table of lookup values. -->
<data>
<item>
<value>one</value>
</item>
<item>
<value>two</value>
</item>
<item>
<value>three</value>
</item>
</data>
<!-- This node needs to be repeatedly transformed for each input
data item -->
<repeat>
Item <value-of name="value"/> is in position <position-of
name="value"/>
</repeat>
</input>
<xsl:stylesheet ...>
<xsl:variable name="repeater" select="/input/repeat"/>
<xsl:template match="repeat"/>
<!-- suppresses output on default traversal -->
<xsl:template match="data">
<xsl:for-each select="item">
<xsl:apply-templates select="$repeater" mode="repeat">
<xsl:with-param name="item" select="."/>
<xsl:with-param name="pos" select="position()"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
<xsl:template match="repeat" mode="repeat">
<xsl:param name="item" select="/.."/>
<xsl:param name="pos" select="0"/>
<item>
<xsl:apply-templates>
<xsl:with-param name="item" select="$item"/>
<xsl:with-param name="pos" select="position()"/>
</xsl:apply-templates/>
</item>
</xsl:template>
<xsl:template match="value-of">
<xsl:param name="item"/>
<xsl:value-of select="$item"/>
</xsl:template>
<xsl:template match="position-of">
<xsl:param name="pos"/>
<xsl:value-of select="$pos"/>
</xsl:template>
</xsl:stylesheet>
Untested.
Cheers,
Wendell
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--