Re: [xsl] how to match node set with attribute then pass toatemplate

Subject: Re: [xsl] how to match node set with attribute then pass toatemplate
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 29 Sep 2003 22:00:57 -0400
At 2003-09-29 15:46 -0400, Biying Huang wrote:
Thank you very much. It works perfectly for me.

I'm glad!

By the way, I am new to XSLT, and not quite understand things like:

<xsl:if test="count( preceding-sibling::Attachment[@showImage='true'] ) mod 2
= 0">

The above asks "is it true that the modulo 2 of the count of my preceding sibling elements named Attachment that have a showImage attribute of 'true' is zero?" All Attachment elements with the showImage attribute of 'true' are being processed in the <xsl:apply-templates/> but I only want to act on every second one. By asking this question, I only get a true every second such element, starting with the first. This means I can start every row for every second such element.


This addresses the closest following sibling Attachment element with the showImage attribute of 'true'. This closest sibling is the one being skipped in my modulo arithmetic in the other test.

Which of your books should I read first?

The "for sale" version of each book is complete, the downloadable versions are only excerpts. The complete XSLT/XPath book will help you with the above two questions. The complete XSL-FO book will help you with my comment about using two blocks to position the information above and below each other.

Alternatively, you might be interested in attending our publicly subscribed training courses in Raleigh, North Carolina during the week of October 13, 2003. In the XSLT course I cover every element, attribute and function of both XSLT and XPath. In the XSL-FO course I cover every formatting object. Details are on my web site noted below.

I hope the above descriptions help.

.............. Ken

Next public US delivery:        3-day XSLT/2-day XSL-FO 2003-10-13
Next public European delivery:  3-day XSLT/2-day XSL-FO 2003-11-??
Instructor-led on-site corporate, government & user group training
for XSLT and XSL-FO world-wide:  please contact us for the details

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 0-13-140374-5                               Definitive XSL-FO
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:
Male Breast Cancer Awareness

XSL-List info and archive:

Current Thread