Hi Abel,
Please find the code below.
XML
<?xml version="1.0" encoding="UTF-8" ?>
<elem id="1234" date="14 Aug 2006" time="13:36">
<title>Sample Title</title>
<text>
<p> This is some data </p>
<p> </p>
<p> This is some special characters &lt;AHLN.AS&gt; </p>
<p> A group of students have gone to picnic. </p>
<p> </p>
<PRE> ** This is another special tag
</PRE></text>
</elem>
XSL
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform&quot;>
<xsl:output method="html" indent="no"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="p//text()">
<xsl:call-template name="transformXMLString">
<xsl:with-param name="StringToTransform" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="transformXMLString">
<xsl:param name="StringToTransform" select="."/>
<!--
logic for replacing line break and double quote
-->
</xsl:template>
</xsl:stylesheet>
Current output
<elem id="1234" date="14 Aug 2006" time="13:36">
<title>Sample Title</title>
<text>
<p> This is some data </p>
<p> </p>
<p> This is some special characters &lt;AHLN.AS&gt; </p>
<p> A group of students have gone to picnic. </p>
<p> </p>
<PRE> ** This is another special tag
</PRE></text>
</elem>
Desired Output
Elem Id, News Details
1234, "<p> This is some data </p><br><p></p><br><p> This is some
special characters &lt;AHLN.AS&gt; </p><br><p> A group of students
have gone to picnic. </p><br><p> </p><br><PRE> ** This is another
special tag<br></PRE></text><br></elem>"
The header should be in one line and the data in one line(CSV like
output).
The logic for replacing line break and double quote is simple recursive
function and I don't think I need to paste it here. It will
unnecessarily make the mail big.
Thanks & Regards,
Ambika Prasad Das
-----Original Message-----
From: Abel Braaksma [mailto:abel.online@xxxxxxxxx]
Sent: Friday, September 08, 2006 5:29 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Replace new lines by <br> and double quote with
special char: Problem retaining HTML tags
Ambika.Das@xxxxxxxxxxxxxxxxxx wrote:
> My apologies. There was a typo in the XML. Once again I am giving the
> input and output
>
Please be attentive to what you submit, and read through the replies you
get before answering. David has given you a possible solution. Just
resubmitting the same question with corrected inp/outp will not really
help, as it is only part of the story.
In some of the postings you asked "is it possible to do so in xslt".
Answer: yes
In most of your questions you ask how to embed html (or xhtml?) inside
CSV-like output. This is possible also. My guess is that David's reply
is just about that (but I didn't try it myself. He did, but more
importantly: *you* should try it).
Since you don't supply the requested XSLT, the part that you tried
yourself and what errors you got or where it went wrong, and since we
have no clue whatsoever of whose answers where helpful and whose weren't
and why, it is impossible to guide you further. Unless of course you
decide to respond to the questions you have got, you supply the XSLT
that you have so far and you reply to the suggested solutions and what
your findings where.
Cheers,
Abel Braaksma
http://abelleba.metacarpus.com
> -----Original Message-----
> From: David Carlisle [mailto:davidc@xxxxxxxxx]
> Sent: Thursday, September 07, 2006 6:46 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Required help in XSL transformation
>
>
>
>> Any clues how to implement the same?
>>
> did you try the template I posted earlier? Why start a new thread with
> an identical question?