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

Re: Newbie Question: Creating Error Description from

Subject: Re: Newbie Question: Creating Error Description from Invalid Input
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 13 Oct 2006 13:01:15 -0400
Re:  Newbie Question: Creating Error Description from
At 10:41 AM 10/13/2006, Richard wrote:
If there is a XPath expression to match elements by whether they have any text
content or not which would be better:


<xsl:template match="header">
  <header>
    <xsl:apply-templates select="all address* children with content" />
  </header>
  <xsl:if test="count(all address* children without content) &gt; 0">
    <errorDescription>
      <xsl:value-of select="all address* children without content" />
    </errorDescription>
  </xsl:if>
</xsl:template>

Any ideas if such an XPath exists?

select="address[normalize-space()]"


selects all address element children that have some non-whitespace text content within them.

select="address[not(normalize-space()]" selects address elements that contain only whitespace, nothing, or elements containing only whitespace, nothing (or elements containing only whitespace, nothing, etc). This is because it tests for the string value of the element, after whitespace is normalized and trimmed.

This can be changed or adjusted for other definitions of "content".

Cheers,
Wendell

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-2011 All Rights Reserved.