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

Re: Transform symbol to element

Subject: Re: Transform symbol to element
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 11 Nov 2009 12:36:20 +0100
Re:  Transform symbol to element
Selvaganesh wrote:

This is possible to convert the quote symbol to xml elements?

If anybody know the way please share me, below placed my input file format
and required output format.
Input XML:


<p>This is the sample of double quote starting the double publication
ended</p>
<p>This is the sample of single quote starting the single publication
ended</p>


Output XML:


<para>This is the sample of double quote starting <quote open=""
close="">the double publication</quote> ended</para>
<para>This is the sample of single quote starting <quote open=""
close="">the single publication</quote> ended</para>

With XSLT 2.0 you can try it as follows:



<xsl:template match="p"> <para> <xsl:analyze-string select="." regex="()([^]*)()|()([^]*)()"> <xsl:matching-substring> <quote open="{regex-group(1)}" close="{regex-group(3)}"> <xsl:value-of select="regex-group(2)"/> </quote> </xsl:matching-substring> <xsl:non-matching-substring> <xsl:value-of select="."/> </xsl:non-matching-substring> </xsl:analyze-string> </para> </xsl:template>


--


	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

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.