xsl-list
[Top] [All Lists]

Re: problem converting xml to excel

2004-03-12 12:27:09
Anna,

At 01:38 PM 3/12/2004, you wrote:
I was wondering if I can check if the string-length for a element is greater
than 0 and then display the required results.

Is there any method like that?

The easiest way is simply test="$string". A string tests as true if it has content, false if it is empty (has length zero).

There is also a string-length function, but test="string-length($string) > 0" is a long way of testing the same thing as test="$string".

When operating on an element (or rather, on a node set containing a single node), test="string($element)" will do it. The string() function turns its operand into a string; a node set turned into a string is the string value of the first node in the set in document order. So if the element you want to test is the current node, of course this can be test="string(.)" or even "string()", since the default operand is the context node of the function.

On the Mulberry web site is a Quick Reference page to XSLT/XPath 1.0 which lists all the standard functions. See

http://www.mulberrytech.com/quickref/index.html

Enjoy,
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