This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

do I have better option other than mode


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]