This is the mail archive of the
docbook@lists.oasis-open.org
mailing list for the DocBook project.
Re: apply-templates within for-each???
- From: Bob Stayton <bobs at caldera dot com>
- To: Ethan Vaughn <ethan at gurulabs dot com>
- Cc: docbook at lists dot oasis-open dot org
- Date: Thu, 06 Feb 2003 17:42:37 -0800
- Subject: Re: DOCBOOK: apply-templates within for-each???
- References: <200302061408.42111.ethan@gurulabs.com>
In your example code, you have:
select=""
I think you want:
select="."
Nothing to process otherwise. 8^)
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com
On Thu, Feb 06, 2003 at 02:08:42PM -0700, Ethan Vaughn wrote:
> 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
> --------------------------------------
--
Bob Stayton 400 Encinal Street
Publications Architect Santa Cruz, CA 95060
Technical Publications voice: (831) 427-7796
The SCO Group fax: (831) 429-1887
email: bobs@sco.com