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

RE: Simple Problem

Subject: RE: Simple Problem
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Fri, 28 Apr 2000 15:10:32 -0400 (EST)
RE: Simple Problem
At 28 Apr 2000 10:45 PDT, Mark Swardstrom wrote:
 > So, my question remains, how can I treat elements without explicit string 
 > data (such as <root> or <node> below) differently than those with data?

Every element node has a string value that is the concatenation of all
of its text node descendants.  You appear to be only interested in
text node children, and don't appear to want to count text nodes
containing only whitespace characters (e.g. the line feed and space
characters between the <root> and <node> start tags in your sample
document).

Try this:

------------------------------------------------------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <!-- Strip text nodes containing only whitespace characters -->
  <xsl:strip-space elements="*"/>

  <!-- Match elements that DO NOT have text node children -->
  <xsl:template match="*[not(child::text())]">
    <p><xsl:value-of select="name()"/> has no (non-stripped) text children.</p>
    <xsl:apply-templates/>
  </xsl:template>

  <!-- Match elements that aren't matched by higher-priority rule -->
  <xsl:template match="*">
    <p><xsl:value-of select="name()"/> has (non-stripped) text children.</p>
    <xsl:apply-templates/>
  </xsl:template>

  <!-- Suppress text nodes because we just want our messages -->
  <xsl:template match="text()"/>

</xsl:stylesheet>
------------------------------------------------------------

Regards,


Tony Graham
======================================================================
Tony Graham                            mailto:tgraham@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9632
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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