Subject: Re: xpath - check for no content
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Tue, 30 Jul 2002 14:01:49 +0200
|
As far as I understand your problem, the normalize-space() test provided by
Ken is your solution. You want to test whether there is *no text* in your
element, where *no text* means for you *no non-whitespace text*. The simple
test on text() fails, because there are whitespaces. Trim them by
normalize-space() and you'll see whether there is *non-whitespace text*
contained or not. There will be no difference to handle the break.
Regards,
Joerg
sascha wrote:
I have to transform this into xsl:fo !
so, i do really NEED the additional break here!
background is- i am tranforming a Lotus Notes XML Export into a PDF
Dokument.
Some linbreaks and Paragraphs don't "get through" my templates at the
moment.
I am trying to figure out what's wrong or try to find a workaround, so that
the output looks like the Notes document.
I will try to see if your hints get me any further.
Thanks,
Sascha
----- Original Message -----
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, July 29, 2002 5:57 PM
Subject: Re: xpath - check for no content
At 2002-07-29 17:43 +0200, sascha wrote:
simple question i guess:
How do i check if the <run> element or one of it's childsren does not
have
any content?
Meaning that there is no output text or so inbetween.
In your example below, you do have text in between ... you have text nodes
comprised only of white-space characters.
example:
<run>
<font size="17pt" style="bold" name="Arial" color="red"/>
<break/>
</run>
I tried...
If the white-space *is* significant, just check the value of the current
node:
<xsl:if test=". = ''">
If the white-space *isn't* significant, trim leading and trailing just in
case the input was "lazily" empty:
<xsl:if test="normalize-space(.)=''">
Note this is a common problem where users *think* an element is empty, but
they've inserted a new-line to make the indentation look nice, not
realizing they no longer have an empty element.
I hope this helps.
.................. Ken
--
System Development
VIRBUS AG
Fon +49(0)341-979-7419
Fax +49(0)341-979-7409
joerg.heinicke@xxxxxxxxx
www.virbus.de
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|