Subject: [xsl] pre-processing of child elements From: Torsten Schassan <a2345447@xxxxxxxxxxxxxxxxxx> Date: Thu, 7 Jul 2005 16:27:42 +0200 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Sorting Problem, Michael Kay | Thread | Re: [xsl] pre-processing of child e, David Carlisle |
Re: [xsl] Listing all element/attri, James Cummings | Date | Re: [xsl] pre-processing of child e, David Carlisle |
Month |