[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

pre-processing of child elements

Subject: pre-processing of child elements
From: Torsten Schassan <a2345447@xxxxxxxxxxxxxxxxxx>
Date: Thu, 7 Jul 2005 16:27:42 +0200
wexelblat s scheduling algorithm
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>&lt;/i&gt;</xsl:text>
  </xsl:if>
  <xsl:apply-templates/>
  <xsl:if test="parent::element">
    <xsl:text>&lt;i&gt;</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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.