Re: [xsl] Some simple questions...

Subject: Re: [xsl] Some simple questions...
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 23 Nov 2001 17:41:14 +0000
Hi José,

> Q1: How do I test if an element is empty without using
> string-length?

Convert its value to a string with the string() function. When you
convert a string to a boolean, it results in boolean true if the
string has any characters in it and boolean false if it doesn't. The
string() function also takes the current node as its default argument,
so you don't even have to put anything inside the brackets.

For example, to see whether to bother doing anything with your aluno
element, you could do:

<xsl:template match="aluno">
  <xsl:if test="string()">
    ... do something ...

> Q2: Is there a nice XSLFO processor binary that I can easily install
> on a Windows or Linux system?

I found both XEP and FOP reasonably easy to install, especially as
they both have .bat and .sh files so that you can use them really
easily, without having to worry about classpath stuff despite the fact
they're written in Java. If you don't like using the command line,
then the Antenna House XSL Formatter is good, though it doesn't
support the full Recommendation yet, I think.



Jeni Tennison

 XSL-List info and archive:

Current Thread