Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xsl:if test fails when source xml element on 2 lines

From: KW <kevinw@------.--.--->
To: 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



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent