Re: Determining if the first child is a para element

Subject: Re: Determining if the first child is a para element
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Nov 2000 17:10:58 -0500
At 00/11/08 19:08 -0800, kenb@xxxxxxxxxxx wrote:
I've looked at the FAQ which describes how to determine if a node has a
single child element, but I need to know if the first child of a node is an
element (para, in this case).  The test needs to be done in the parent's
<template> element, prior to an <apply-templates/>.  Is there a
straightforward <if> test I can use for this case?  Thanks!

If you don't care what the name of the element is, how about:


<xsl:if test="generate-id(*)=generate-id(node())">

This function operates on only the first member of the supplied node list.

I hope this helps.

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

--
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Book: Practical Transformation Using XSLT and XPath ISBN1-894049-05-5
Article:          What is XSLT? http://www.xml.com/pub/2000/08/holman
Next public instructor-led training:        2000-12-03/04,2001-01-27,
-                                 2000-02-21,2000-03-26,2000-04-06/07


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread