At 06:20 AM 5/3/2005, David wrote:
> Hi,
> You can do this using:
>
><xsl:if test="*[self::length]"> or
That is more easily written as
<xsl:if test="length">
> or
>
> <xsl:if test="*[name() = 'length']">
Translations from XPath short to long syntax:
"length" is short for
"child::length"
(set of 'length' element children of context node)
"*[self::length]" is short for
"child::*[self::length]
(set of element children that have a 'length' element on the self axis)
"*[name() = 'length']" is short for
"child::*[name() = 'length']"
(set of element children that return 'length' as the result
of the name() function with an implicit argument of "self::node()")
The xsl:if test works by evaluating the test expression and returning a
Boolean; then depending on the Boolean value, the contents of the xsl:if
are processed (or not). When the result is not already a Boolean, it is
"coerced" using the XPath casting rules. All these tests work because the
casting rule for a node-set to a Boolean is that the set is true if it has
any members, false if it is empty.
Cheers,
Wendell
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--