do I have better option other than mode

Subject: do I have better option other than mode
From: "Pollington, Lee (ELSLON)" <lee.pollington@xxxxxxxxxxxxx>
Date: Mon, 20 Nov 2000 11:12:25 -0000
Hi all,

I working on a stylesheet covering over 170 elements. Many elements have an
"id" attribute. Now I want to output an HTML target for every element with
and "id", I thought

<xsl:if test="@id">.....</xsl:if>

would be a bit messy in every template that needed it, so I thought I could
do:

<xsl:template match="*[@id]">
        <a name="{@id}"/>
        <xsl:apply-templates select="." mode="has-id"/>
</xsl:template>
 
<xsl:template match="fig" mode="has-id">.....</xsl:template>
 
However that still means knowing which templates are going to need that mode
and on the face of it makes the templates themselves less reusable, it
doesn't look too efficient either, but I don't know about that. I was hoping
to do something a little more generic.
 
Any suggestions?
 
Kind regards
Lee


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread