Topic: Displaying characters in multiple lines in browser using java dom+xml+xsl+html Pages that link to <a href="https://ozoneasylum.com/backlink?for=30846" title="Pages that link to Topic: Displaying characters in multiple lines in browser using java dom+xml+xsl+html" rel="nofollow" >Topic: Displaying characters in multiple lines in browser using java dom+xml+xsl+html\

 
Author Thread
Nimmala
Obsessive-Compulsive (I) Inmate

From:
Insane since: Feb 2009

IP logged posted posted 02-15-2009 09:31 Edit Quote

Hi i am using xml and xsl to display characters in multiple lines
the text content is like this "mm\r\nkk\r\njj" but i am unable to display this characters in multiple lines like below in the browser

mm
kk
jj

actually in our java class we are creating textnode for the above text using document object like doc.createTextnode("mm\r\nkk\r\njj")
in xsl we are reading this data as <xsl:value-of select="text()"/>

could anybody suggest me how to display characters in multiple lines using xsl in the browser.


Naresh.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 02-15-2009 10:04 Edit Quote

Well, either wrap them in a <pre>, or have the xsl transform the \n to a <br>...

Nimmala
Obsessive-Compulsive (I) Inmate

From:
Insane since: Feb 2009

IP logged posted posted 02-15-2009 11:17 Edit Quote

Thanks for your reply Prime. If i was trying to replace \n with <br> in the java code which generates xml content for xsl then browser is displaying <br> as it is with textcontent. Prime could you please give me an example.

Nimmala
Obsessive-Compulsive (I) Inmate

From:
Insane since: Feb 2009

IP logged posted posted 02-15-2009 16:02 Edit Quote

please help me in this

(Edited by Nimmala on 02-15-2009 16:13)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 02-15-2009 19:14 Edit Quote

hello nimall,

this is a forum, not a one stop help stop.
You've not given us enough information to figure out the best way to do it.
My guess would be your xml generator (correctly) encodes your tags,
so you can't inject html at this stage.

Google suggests this link: http://www.biglist.com/lists/xsl-list/archives/199908/msg00501.html
but you could create a paragraph node per , well not line, but paragraph, in java.
or do a

code:
for (String line: text.split("\n")
{
 doc.createTextNode(line);
 doc.createNode("<br>");  
}



I have the feeling you should start reading about this web stuff at the beginning.

So long,

->Tyberius Prime



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu