Below is a fictitious example to do what you want
(hope you may adapt to your XML)..
The XML file is -
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<document>
<para>{i}this{/i} is {i}an{/i} example 1</para>
<para>this is an {i}example 2{/i}</para>
<para>this is an example 3</para>
<para>th{i}is{/i} is an {i}ex{/i}ample
{i}4{/i}</para>
</document>
And XSLT stylesheet is -
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="/document">
<html>
<head>
<title></title>
<body>
<xsl:for-each select="para">
<p>
<xsl:call-template
name="italics-template">
<xsl:with-param name="text" select="."
/>
<xsl:with-param name="startdelim"
select="'{i}'" />
<xsl:with-param name="enddelim"
select="'{/i}'" />
</xsl:call-template>
</p>
</xsl:for-each>
</body>
</head>
</html>
</xsl:template>
<!-- template to create italics tags -->
<xsl:template name="italics-template">
<xsl:param name="text" />
<xsl:param name="startdelim" />
<xsl:param name="enddelim" />
<xsl:choose>
<xsl:when test="contains($text, $startdelim) and
contains($text, $enddelim)">
<xsl:value-of select="substring-before($text,
$startdelim)" />
<i><xsl:value-of
select="substring-before(substring-after($text,$startdelim),
$enddelim)" /></i>
<xsl:call-template name="italics-template">
<xsl:with-param name="text"
select="substring-after($text,$enddelim)" />
<xsl:with-param name="startdelim"
select="$startdelim" />
<xsl:with-param name="enddelim" select="$enddelim"
/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
The result of transformation is -
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
<title></title>
<body>
<p><i>this</i> is <i>an</i> example 1
</p>
<p>this is an <i>example 2</i></p>
<p>this is an example 3</p>
<p>th<i>is</i> is an <i>ex</i>ample
<i>4</i></p>
</body>
</head>
</html>
All {i}...{/i} pairs are replaced by <i>...</i> .
I am also able to see the desired output in the
browser (IE 6)..
I won't say this is best approach. But I think it
achieves what you want..
I hope this helps you..
Regards,
Mukul
--- Ahalya <ahalya(_at_)lantana(_dot_)cs(_dot_)iitm(_dot_)ernet(_dot_)in> wrote:
Greetings!
I am having some characters like {i},{/i} in
the xml file. whenever i
find the word like {i} in xml i shd replace the "{"
with "<" and while
viewing the contents in the html browser i shd get
the text to be italised
once it finds the tag like that..Can any one tell me
how to do that ?
for example {i}Hi{/i} --> shd appear like Hi in
italised format in
browser.
Regards
S.Ahalya
"Be nice to people on your way up because you meet
them on your way down."
- Jimmy Durante
--~------------------------------------------------------------------
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>
--~--
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--~------------------------------------------------------------------
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>
--~--