[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: George Cristian Bina <george@xxxxxxx>
Date: Tue, 01 Jun 2004 11:36:38 +0300
george bina
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>
>> [...]

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.