Re: [xsl] testing for attribute-only

Subject: Re: [xsl] testing for attribute-only
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 29 Aug 2005 12:18:06 -0400
Trevor:

test="node()" is short for test="child::node()", and will test true on the latter cases while false on the former cases.

test="not(node())" will perform the inverse test.

This is because attributes are not children of their parent elements in the model. Comments, processing instructions, elements and text nodes are the only kinds of things addressable through the child:: (and descendant::) axis.

Cheers,
Wendell

At 12:42 AM 8/28/2005, you wrote:
Is there a concise test for the context node that will distinguish between a
node that has attributes at most:

  <a><a/>
  <a docref="123456"/>

and a node that has more than attributes?

  <a>some text</a>
  <a case="2"><elementary>my dear Watson</elementary><a/>

I have been inadvertently dropping a few dozen of the latter type in trying
to clean up several thousand of the former in my input documents.



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

Current Thread