[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xpath - check for no content

Subject: Re: xpath - check for no content
From: "sascha" <sascha@xxxxxxxxxx>
Date: Tue, 30 Jul 2002 14:39:01 +0200
xpath check for empty element
yes, and it works ( normalize space! )

thanks

sascha


----- Original Message -----
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, July 30, 2002 2:01 PM
Subject: Re:  xpath - check for no content


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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.