Welcome to WebmasterWorld Guest from 23.22.220.37

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Transform xml pasted into textarea

     
11:29 pm on Nov 29, 2006 (gmt 0)

New User

10+ Year Member

joined:Aug 8, 2005
posts:7
votes: 0


I have a textarea element that I want to allow users to paste the contents of an xml file into. Once pasted into the texarea I would like to transform the xml and display the html output on a new page.

Is this easily done? And if so, can anyone give a few pointers?

Regards,
DAK

1:54 am on Nov 30, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10542
votes: 8


XSLT is where you want to look for an answer.
(Extensible Stylesheet Language Transformations)
if you google or search WebmasterWorld you will find some answers...
11:00 am on Nov 30, 2006 (gmt 0)

New User

10+ Year Member

joined:Aug 8, 2005
posts:7
votes: 0


Yeah, I know how to transform xml with xslt.

What the problem is, is that there is no xml file as such. There is only xml markup (without an xsl stylesheet link) pasted into a textarea. I would like to transform this with an xsl stylesheet that resides on the server.

How do I transform xml markup in a textarea?

I guess I'm asking how to "get at" the data within the textarea.

12:01 pm on Nov 30, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Nov 3, 2005
posts:1585
votes: 0


to get text

text = document.getElementById( "myTextArea" ).value;

to parse it

var doc = new DOMParser().parseFromString( text, "text/xml" );
var documentElement = doc.documentElement;

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members