Hi,
I've got this problem and question: I need to display the text() of an element
in italics but the child elements in non-italics. Is it possible to pre-process
child-elements within a template of their parent? Is it possible to turn around
the processing and not ask "If the element is child of a certain element, then
behave soandso" but ask "wrap all your children into soandso code"?
In pseudo-code:
<xsl:template match="element">
<i>
<xsl:value-of select="text()"/>
<non-i><xsl:apply-templates select="child-elements"/></non-i>
</i>
</xsl:template>
So far I always seem to have to go the following way, but with a lot of other
things to check inside the templates for the processing of the child-elements,
this can quickly become very nasty coding!
<xsl:template match="element">
<i><xsl:apply-templates/></i>
</xsl:template>
<xsl:template match="child-element">
<xsl:if test="parent::element">
<xsl:text></i></xsl:text>
</xsl:if>
<xsl:apply-templates/>
<xsl:if test="parent::element">
<xsl:text><i></xsl:text>
</xsl:if>
</xsl:template>
Do I hit the point or is there any other way around the problem?
Thank you very much in advance, any advice will help,
Torsten Schassan
-----
Wexelblat's Scheduling Algorithm:
Choose two: Good / Fast / Cheap
-----
Torsten Schassan (Projekt Handschriftendatenbank/MASTER)
Herzog August Bibliothek, Postfach 1364, D-38299 Wolfenbuettel
Tel.: +49-5331-808-117, schassan at hab dot de
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--