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

Testing the number of child elements

Subject: Testing the number of child elements
From: Emmanuel Pietriga <emmanuel.pietriga@xxxxxxxxxxxxxx>
Date: Thu, 10 Feb 2000 14:51:31 +0100
xsl number of child

Here's my problem: I want to test if the current node (plus) has one
child or more   (I don't output the same thing if it has one child
element or more than one). And I want to do this for all elements "plus"
of "apply" using a for-each.
I am saying that current node is (plus) because I think it is true when
we are in the for-each loop. Am I right? That is, does current()
actually returns the "plus" element?

Here is what I do, but it doesn't work  (XT always chooses the
"otherwise" solution)

<xsl:template match="apply[plus]">
  <xsl:for-each select="child::*[position()!=last() and
    <xsl:when test="count(current()/child::*)=1">
      <xsl:apply-templates select="."/><mo>+</mo>
      <mrow><xsl:apply-templates select="."/></mrow><mo>A</mo>

The XML source is:


By the way, I have another little question: I've included a DOCTYPE in
my stylesheet because I define entity references in it.
One of these entities is InvisibleTimes.  I know its unicode is E89E
So I've written <ENTITY InvisibleTimes "&#E89E;">, but XT tells me
"character not allowed"
What can I Do?


emmanuel.pietriga@xxxxxxxxxxxxxx               |  Xerox Research Centre Europe
Document Model and Transformation Technologies |  6, Chemin de Maupertuis
+33 4 76 61 50 32  (direct)                    |  38240 Meylan, France
+33 4 76 61 50 50  (switchboard)               |  http://www.xrce.xerox.com

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

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.