Reject an attribute that has only spaces in schema

H

hellostephen

Hi.

I'm looking for a way reject an xml document with an attribute
that has whitespace only. This is not so hard when the attribute
is an empty string but the whitespaces has me stumped.

BTW I know very little regular expression syntax.

Thanks.
 
P

Peter Flynn

Hi.

I'm looking for a way reject an xml document with an attribute
that has whitespace only. This is not so hard when the attribute
is an empty string but the whitespaces has me stumped.

<xsl:if test="normalize-space(@foo)=''">

Counter-intuitive, as the normalize-space function condenses multiple
sequential white-space tokens to a single space when they occur between
non-white-space characters, but zaps them completely when they occur in
isolation. It's consistent with the action taken for leading and trailing
multiple white-space, rather than with the action taken on white-space
between words.
BTW I know very little regular expression syntax.

Not needed in this case.

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,843
Latest member
WizcraftEntertainmentAgen

Latest Threads

Top