473,403 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

hello

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
4 1879


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
> 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


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
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
24
by: Andy Sutorius | last post by:
Has anyone successfully created a Hello World program without using Visual Studio.NET? If so, what IDE did you use and what namespaces did you import? Thanks! Andy Sutorius
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
5
by: Daniel Crespo | last post by:
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Thanks
10
by: fei.liu | last post by:
Consider the following sample code char * ptr = "hello"; char carray = "hello"; int main(void){ } What does the standard have to say about the storage requirement about ptr and carray? Is...
4
by: arnuld | last post by:
i am learning C and doing the exercise 1-1 of K&R2, where K&R ask to remove some parts of programme and experiment with error, so here i go: #include <stdio.h> int main () { printf('hello...
1
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details...
0
by: devito | last post by:
hi there, for some days i try to build the boost.python tutorial "hello world" without bjam on winxp by using mingw. so i wrote a *.bat-file like the following: // --- snip...
0
Nepomuk
by: Nepomuk | last post by:
Hi everybody! As was suggested here, today should be Hello World Day! So, here's my Hello World Program in bash script: #!/bin/bash i=0; function hello { case $i in 0) echo 'H' i=`expr...
0
by: tosreejithp | last post by:
Hi, My first problem was i am not able to compiled a file from java script to java class.Now its clear and working fine..now i can convert a java script file to java class by Rhino Java Script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.