[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] RE: Delete child <section> via xsl
Thanks for the suggestion Rob. When I try this I get: XSLT-apply-templates: could not compile select expression '*[not(name() = 'title']' - Josh ----- Original Message ----- From: "rob cavicchio" <rob.cavicchio@emc.com> To: docbook-apps@lists.oasis-open.org Sent: Friday, May 4, 2012 12:55:19 AM Subject: [docbook-apps] RE: Delete child <section> via xsl Joshua J Wulf [mailto:jwulf@redhat.com] wrote: > I'd like to do the following with an xsl template: > > If a section or chapter contains an immediate child section with the > same title, then > delete the child's<section/> and<title/> tags, but not the contents > between the child<section> and</section>. I think that you want to do something like the following (untested), though you might have to tweak the details. I'm guessing that the situation you are thinking of is that you have a chapter with only a single section in it. (This code does not actually test to make sure that there are no other sections within the chapter, but it could be made to do so.) <xsl:template match="section"> <xsl:choose> <xsl:when test="string(title) = string(../title)"> <xsl:apply-templates select="*[not(name() = 'title']" /> </xsl:when> <xsl:otherwise> <!-- NORMAL SECTION PROCESSING --> </xsl:otherwise> </xsl:choose> </xsl:template> ************************* Rob Cavicchio rob.cavicchio@emc.com Principal Technical Writer & Information Architect Information Intelligence Group EMC Corporation The opinions expressed here are my personal opinions. Content published here is not read or approved in advance by EMC and does not necessarily reflect the views and opinions of EMC. --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]