[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: DOCBOOK: Decorating a template call?
I wanted to be able to have a way to make an author's name into a link and so added a url attribute to the author element. To process this new attribute, I had to customize the person.name template. The real work is still done in a slightly changed copy of the original template. The only change is the new name. Works fine, but the code duplication is not pretty: <xsl:template name="person.name"> <xsl:param name="node" select="."/> <xsl:choose> <xsl:when test="$node/@url"> <a href="{$node/@url}"> <xsl:call-template name="person.name.original"> <xsl:with-param name="node" select="$node"/> </xsl:call-template> </a> </xsl:when> <xsl:otherwise> <xsl:call-template name="person.name.original"> <xsl:with-param name="node" select="$node"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="person.name.original"> <!-- ...duplicated original template... --> </xsl:template> The duplication could be avoided if there was an indirection in the docbook stylesheets. But that doesn't seem right, either. Michael -- Michael Schuerig If at first you don't succeed... mailto:schuerig@acm.org try, try again. http://www.schuerig.de/michael/ --Jerome Morrow, "Gattaca"
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC