Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: xsl:if test fails when source xml element on 2 lines >Thread Next - Re: xsl:if test fails when source xml element on 2 lines Re: xsl:if test fails when source xml element on 2 linesTo: NULL Date: 5/1/2007 10:28:00 AM On May 1, 12:18 pm, Martin Honnen <mahotr...@yahoo.de> wrote: > KW wrote: > > <xsl:when test="person/email != ''> > > The first test is attempting to determine if the element is not > > "empty", but with the example xml, it is evaluating to true because > > the test is seeing the newline created from the Email element being on > > two lines. I would like to evaulate a node like Email so that even if > > it is on two lines, there is still "no email address" in the element. > > Use > <xsl:when test="normalize-space(person/email) != ''"> > > -- > > Martin Honnen --- MVP XML > http://JavaScript.FAQTs.com/ Thanks. That did it. However, I also figured out that <xsl:strip-space elements="*" /> works to remove all whitespace nodes on a global level. Then, I would not need to use the normalize-space function. This would be handy, especially if I have alot of elements that fall into the same situation. But, I have another question. Is there a better test expression to use in order to figure out if an element is empty as I have defined it? Or is this approach commonly used? Kevin | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
