xsl-list
[Top] [All Lists]

RE: [xsl] display & as text

2010-06-07 10:57:28
Ginny,

At 07:08 PM 6/4/2010, you wrote:
Is there a book that explains where and how and when to do the string
manipulation programmatically on incoming data necessary to allow it to have
the illegal entities changed to legal ones? I am the owner of several xml
and xsl books that don't seem to cover that part of the process.

Strictly speaking the question (indeed the entire thread) is off-topic.

But it is both simple and complicated -- probably why there's no treatment of it in a book. The simple version of it is too simple to need it. The complicated version is both too deep and too general to be much use to a working programmer who has a specific set of issues.

The complex answer accounts for how some characters aren't allowed in XML, so they need to be scrubbed or changed into something else (these are mainly control characters you won't ordinarily see), and how certain constructs (namely, entity references) will be legal if you have declarations for them, but not otherwise, and it is not uncommon to need to resolve these, not simply escape them -- or the other way around (if you need to represent certain characters using character or entity references, not directly). In general, the topic of character encodings and how they relate to data formats is a deep one.

The simple answer is that, if these complications don't intervene, simply escaping all "&" into "&amp;" and "<" into "&lt;" should do the trick: these are the "markup open delimiters", and it should be obvious why they need to be escaped if they aren't serving to delimit markup. Of course, you need to do it in that order, lest your "&lt;" become "&amp;lt;" which isn't what you want (since in XML it represents the string "&lt;" not the character "<").

Cheers,
Wendell



======================================================================
Wendell Piez                            
mailto:wapiez(_at_)mulberrytech(_dot_)com
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>