Re: [xsl] Text markup for web forums, eg. [b]bold text[/b]

Subject: Re: [xsl] Text markup for web forums, eg. [b]bold text[/b]
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 01 Jun 2004 11:49:52 -0400
At 06:31 AM 6/1/2004, George wrote:
How about translating also <> to [] in the first pass and apply in a second pass a copy stylesheet with the output method set to xml this time that will translate the [] back to <> ?

George is being very cunning, but the bottom line here is that none of these approaches have yet proposed a good way of dealing with pseudo-markup that does not map directly to well-formed XML. And by definition, you have no intrinsic way of knowing that all the pseudo-markup you have, does map.


(The reason you can't just change markup delimiters around in XSLT is that internally, the XSLT engine sees no markup; it has all been parsed away in the tree-building process.)

Whether you work at the character level (translating back and forth between different markup delimiters) or try to implement a parser in XSLT (M. David's first approach) -- unless you have a generic solution for converting not-well-formed near-XML into true XML (and it won't be XSLT ;-), this isn't going to work outside controlled environments where you can either preclude badly-formed pseudo-markup altogether (in which case why not use real markup?), or where you can trap it and fix it when it turns up.

Cheers,
Wendell

<?xml version="1.0" encoding="UTF-8"?>
<text>
<value>Text may &lt; contain [b]bold text[/b], [i]italics[/i] or both
[b][i]bold and italics[/i][/b].</value>
</text>


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
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
======================================================================


Current Thread