[Date Prev] [Date Next] [Thread Prev] [Thread Next] Indexes: Main | Date | Thread | Author

Re: [ba-ohs-talk] XSLT question: whitespace in XML attributes


Eugene Eric Kim wrote:    (01)

> I have some questions for you XML/XSLT gurus out there (i.e. Ken and
> whoever else may be lurking. :-).
> 
> 1. Are newlines allowed in attributes?    (02)


Yes.    (03)


> 2. Assuming they are, is there an XSLT command that will allow me to
> preserve the newlines when processing the attributes?  xsl:preserve-space
> seems to be reserved for elements only.    (04)


XSLT operates on what the XML parser provides it, and XML processors are
by definition supposed to normalize whitespace. So this isn't an issue
for XSLT as it would never get the opportunity.    (05)


> The reason I ask is that OPML (http://www.opml.org/) stores outline text
> in HTML attributes rather than as PCDATA.  Not only is this annoying, but
> it also limits my flexibility to process OPML using XSLT.    (06)


This is called Bad Markup Design. If there are things that shouldn't
be in attributes, they simply shouldn't be in attributes.    (07)

Murray    (08)

......................................................................
Murray Altheim                         <mailto:m.altheim @ open.ac.uk>
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK    (09)

      In the evening
      The rice leaves in the garden
      Rustle in the autumn wind
      That blows through my reed hut.  -- Minamoto no Tsunenobu    (010)