Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am doing XSLT transformation in the Safari browser using Javascript.

The final output of my transformation is a document-fragment object whose content is as below

<chart>
<dataset> .... some data </dataset>
<dataset> .... some data </dataset>
</chart>

Basically its the transformed XML output. I need to use this as a string in my Javascript Code.

I am unable to do this using .toString() or whatever. Can somebody please help me here ?

Thank you.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Try XMLSerializer:

var xmlAsDocument = ... // your XSLT result
var xmlAsString = new XMLSerializer().serializeToString( xmlAsDocument );
share|improve this answer
    
Alex, Thank you - that did the trick ! –  Sandeep Jun 21 '13 at 8:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.