This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
apply-templates within for-each???
- From: Ethan Vaughn <ethan at gurulabs dot com>
- To: docbook at lists dot oasis-open dot org
- Date: Thu, 06 Feb 2003 14:08:42 -0700
- Subject: DOCBOOK: apply-templates within for-each???
- Organization: GuruLabs
I'm trying to apply templates within a for-each but the apply-templates never
gets executed. The call-template directive works, but then the HTML i'm
creating (the anchor tag in this case) gets stuck up in <step> rather than
down where the <xref> is. Here' s the code:
<xsl:template match="step">
<xsl:variable name="stepnum">
<xsl:number level="single" count="step" format="1"/>
</xsl:variable>
<xsl:variable name="stepid" select="@id"/>
<p><hr align="left"/><br/>
<!-- create html anchor if id exists //-->
<xsl:if test="@id">
<a name="{@id}"/>
<!-- process all <xrefs> pointed to this <step> //-->
<xsl:for-each select="//xref[@linkend=$stepid]">
<xsl:apply-templates select="" mode="step">
<xsl:with-param name="linktext" select="$stepnum"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:if>
<span class="step"><xsl:value-of select="$stepnum"/>. </span>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="xref" mode="step">
<xsl:param name="linktext" select="LINK"/>
<a href="#{@linkend}">
Step <xsl:value-of select="$linktext"/>
</a>
</xsl:template>
The goal here is to have the number generated in the processing of <step> to
be passed to the <xref> to be used as the html anchor tag text. I'm hoping
to globally process all <xref> pointing to this step.
I've thought about doing the anchor tag inside the <xref> template, but have
no way of getting the step's numerical value.
Any ideas??
--------------------------------------
Ethan Vaughn
ethan@gurulabs.com
--------------------------------------