[xquery-talk] preserving space in attribute content
Howard Katz
howardk at fatdog.com
Tue Jun 6 15:57:44 PDT 2006
We could also rewrite the attribute as an element, as you're suggesting, but
since every other "object" in our system is represented as a attribute, it
would be quite non-standard to do it that way. But other than that, no other
really good reason for not doing so.
What's the &_ ... underscore in your entitized version btw?
Thank you. That was illuminating.
Howard
> -----Original Message-----
> From: Michael Kay [mailto:mhk at mhk.me.uk]
> Sent: June 6, 2006 2:23 PM
> To: 'Howard Katz'; talk at xquery.com
> Subject: RE: [xquery-talk] preserving space in attribute content
>
> >
> > I need to preserve whitespace in an attribute, as in
> >
> > <elem someAttr=" somecontent"/>
> >
> > The space in other words is signficant and I don't want it
> > normalized away on processing. Is this doable?
>
> Do it as you would in XML - entitize the spaces using &_#x20;.
>
> You could also write
>
> <elem someAttr="{' somecontent'}"/>
>
> However, it's not a good design to use attributes for content where
> whitespace is significant: even if you get the whitespace
> into the result
> document, it's liable to be normalized next time it sees the
> inside of an
> XML parser.
>
> Michael Kay
> http://www.saxonica.com/
>
More information about the talk
mailing list