Discussion:
[xquery-talk] Validating an attribute value
Misztur, Chris
2013-12-14 02:01:08 UTC
Permalink
If I want to make sure that an attribute has a value should I check with empty() and functx:all-whitespace()?

-c



________________________________

The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.

Please consider the environment before printing this e-mail
Michael Kay
2013-12-14 09:10:01 UTC
Permalink
If you want to check that an attribute exists and that its value is non-empty and not all whitespace, use

if (normalize-space(@att)) then...

Michael Kay
Saxonica

On 14 Dec 2013, at 02:01, Misztur, Chris <***@macleanfogg.com> wrote:

> If I want to make sure that an attribute has a value should I check with empty() and functx:all-whitespace()?
>
> -c
>
>
>
> ________________________________
>
> The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.
>
> Please consider the environment before printing this e-mail
>
>
> _______________________________________________
> ***@x-query.com
> http://x-query.com/mailman/listinfo/talk
Misztur, Chris
2013-12-15 17:43:15 UTC
Permalink
Thanks. That will do.
________________________________________
From: Michael Kay [***@saxonica.com]
Sent: Saturday, December 14, 2013 3:10 AM
To: Misztur, Chris
Cc: ***@x-query.com
Subject: Re: [xquery-talk] Validating an attribute value

If you want to check that an attribute exists and that its value is non-empty and not all whitespace, use

if (normalize-space(@att)) then...

Michael Kay
Saxonica

On 14 Dec 2013, at 02:01, Misztur, Chris <***@macleanfogg.com> wrote:

> If I want to make sure that an attribute has a value should I check with empty() and functx:all-whitespace()?
>
> -c
>
>
>
> ________________________________
>
> The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.
>
> Please consider the environment before printing this e-mail
>
>
> _______________________________________________
> ***@x-query.com
> http://x-query.com/mailman/listinfo/talk


________________________________

The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.

Please consider the environment before printing this e-mail
David Lee
2013-12-14 13:04:15 UTC
Permalink
assuming your are not particularly pedantic about unicode characters that might look spacy-like ...
this will work

fn:exists($elem/@attribute) and fn: normalize-space( $elem/@attribute ) ne ''

but it all depends on what you mean by 'has a value'



----------------------------------------
David A. Lee
***@calldei.com
http://www.xmlsh.org

-----Original Message-----
From: talk-***@x-query.com [mailto:talk-***@x-query.com] On Behalf Of Misztur, Chris
Sent: Friday, December 13, 2013 9:01 PM
To: ***@x-query.com
Subject: [xquery-talk] Validating an attribute value

If I want to make sure that an attribute has a value should I check with empty() and functx:all-whitespace()?

-c



________________________________

The contents of this message may be privileged and confidential. Therefore, if this message has been received in error, please delete it without reading it. Your receipt of this message is not intended to waive any applicable privilege. Please do not disseminate this message without the permission of the author.

Please consider the environment before printing this e-mail


_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk
Continue reading on narkive:
Loading...