[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: Re: Text markup for web forums, eg. [b]bold text[/b]
From: "M. David Peterson" <m.david@xxxxxxxxxx>
Date: Tue, 1 Jun 2004 03:40:18 -0600
xsl text bold
In rethinking through this and then testing it it occured to me that this solution creates some issues with output escaping. Ive got to attend to some other things this morning but will take a look at this again later.

Best regards,

<M:D/>

----- Original Message ----- From: "M. David Peterson" <m.david@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, June 01, 2004 2:47 AM
Subject: Re: Text markup for web forums, eg. [b]bold text[/b]



Sometimes the most obvious solutions are the ones that get overlooked. Although you would obviously have to process this further for tags like [QUOTE] and [email]. But once the conversion to XML has taken place thats obviously not an issue.

Give me a sec to update the code and Ill repost a much more elegant solution.

Thanks George!

<M:D/>
----- Original Message ----- From: "George Cristian Bina" <george@xxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, June 01, 2004 2:36 AM
Subject: Re: Text markup for web forums, eg. [b]bold text[/b]



Hi,

Just an idea, I do not know if that helps, but...
you can translate the [] in <> and after this you should have well formed XML and process it as you like with another stylesheet:


<text>
<value>Text may contain <b>bold text</b>, <i>italics</i> or both
<b><i>bold and italics</i></b>.</value>
</text>


<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:text>&lt;processedValue&gt;</xsl:text>
<xsl:value-of select="translate(text/value, '[]', '&lt;>')"/>
<xsl:text>&lt;/processedValue&gt;</xsl:text>
</xsl:template>
</xsl:stylesheet>



<processedValue>Text may contain <b>bold text</b>, <i>italics</i> or both <b><i>bold and italics</i></b>.</processedValue>



Best Regards, George ----------------------------------------------- George Cristian Bina <oXygen/> XML Editor & XSLT Editor/Debugger http://www.oxygenxml.com


Daniel Joshua wrote:
I was reading through this, gave me some ideas.

Except that it does not handle nested "markup" like my input (below).


XML (input):

<text>
  <value>Text may contain [b]bold text[/b], [i]italics[/i] or both
[b][i]bold and italics[/i][/b].</value>
</text>
>> [...]

--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--



--+------------------------------------------------------------------
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@xxxxxxxxxxxxxxxxxxxxxx>
--+--



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.