By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,628 Members | 1,696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,628 IT Pros & Developers. It's quick & easy.

hello

P: n/a
Hello
I have a problem with convert document fragment to string in mozilla

var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xslDocument);
var myFragment = xsltProcessor.transformToFragment(xmlDocument, document);

Thanks
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


Pampam wrote:
I have a problem with convert document fragment to string in mozilla

var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xslDocument);
var myFragment = xsltProcessor.transformToFragment(xmlDocument, document);


A fragment is a node, why do you need a string and how do you expect the
string to look, do you want the text content in the fragment node, do
you want to serialize the markup?
If you are converting some IE/MSXML code to Mozilla and are used to
htmlElement.innerHTML = xmlDocument.transformNode(xslDocument)
with IE then for Mozilla you need to learn to use DOM methods e.g.
while (htmlElement.hasChildNodes()) {
htmlElement.removeChild(htmlElement.lastChild);
}
htmlElement.appendChild(myFragment);
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
> A fragment is a node, why do you need a string and how do you expect the
string to look, do you want the text content in the fragment node, do
you want to serialize the markup?
If you are converting some IE/MSXML code to Mozilla and are used to
htmlElement.innerHTML = xmlDocument.transformNode(xslDocument)
with IE then for Mozilla you need to learn to use DOM methods e.g.
while (htmlElement.hasChildNodes()) {
htmlElement.removeChild(htmlElement.lastChild);
}
htmlElement.appendChild(myFragment);


I know in IE is ok, xmlDocument.transformNode(xslDocument) returning string.
I want to show my transform result in a window.alert(), therefore I must
convert this to string.

Thanks
Jul 23 '05 #3

P: n/a


Pampam wrote:
A fragment is a node, why do you need a string and how do you expect the
string to look, do you want the text content in the fragment node, do
you want to serialize the markup?
I want to show my transform result in a window.alert(), therefore I must
convert this to string.


What kind of string do you want, the serialized markup, the text
content? It is not clear what kind of string value you are looking for.

If you want the serialized HTML markup then do
var div = document.createElement('div');
div.appendChild(myFragment);
alert(div.innerHTML);

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

P: n/a
> If you want the serialized HTML markup then do
var div = document.createElement('div');
div.appendChild(myFragment);
alert(div.innerHTML);

THANKS !!!! its it :)
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.