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

Re: Copy-per-default

Subject: Re: Copy-per-default
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 20 Apr 2011 17:57:38 +0200
Re:  Copy-per-default
Fredrik Bengtsson wrote:

<xsl:template match="/d:book">
   <!-- ignoring root, page-sequence etc for brevity -->
   <xsl:apply-templates />

<xsl:template match="d:chapter">
   <xsl:apply-templates />

<xsl:template match="d:chapter/d:title">
   <fo:block>  ... ...</fo:block>

Then for some reason the titleabbrev appears in the output even though I have not made any rule explicitly matching it. It is caught along with the title inside the apply-templates under d:chapter. I thought that this would not happen, unless I really added a matching template of some sort, for example an identity transform.

Well in your template for chapter you do apply-templates meaning you process all child nodes. Then there is a built-in template that does the same for any element nodes not having a template in your stylesheet and there is a built-in template for text nodes that does xsl:value-of, thus the contents of the titleabbrev is copied to the output.

You can remedy this by either only selecting the title element with your apply-templates in the chapter template

<xsl:template match="d:chapter">
  <xsl:apply-templates select="d:title"/>

or by suppressing text output with

<xsl:template match="text()"/>


	Martin Honnen

Current Thread


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.
First Name
Last Name
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.