hello

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pampam

    #1

    hello

    Hello
    I have a problem with convert document fragment to string in mozilla

    var xsltProcessor = new XSLTProcessor() ;
    xsltProcessor.i mportStylesheet (xslDocument);
    var myFragment = xsltProcessor.t ransformToFragm ent(xmlDocument , document);

    Thanks


  • Martin Honnen

    #2
    Re: hello



    Pampam wrote:
    [color=blue]
    > I have a problem with convert document fragment to string in mozilla
    >
    > var xsltProcessor = new XSLTProcessor() ;
    > xsltProcessor.i mportStylesheet (xslDocument);
    > var myFragment = xsltProcessor.t ransformToFragm ent(xmlDocument , document);[/color]

    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.inn erHTML = xmlDocument.tra nsformNode(xslD ocument)
    with IE then for Mozilla you need to learn to use DOM methods e.g.
    while (htmlElement.ha sChildNodes()) {
    htmlElement.rem oveChild(htmlEl ement.lastChild );
    }
    htmlElement.app endChild(myFrag ment);


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Pampam

      #3
      Re: hello

      > A fragment is a node, why do you need a string and how do you expect the[color=blue]
      > 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.inn erHTML = xmlDocument.tra nsformNode(xslD ocument)
      > with IE then for Mozilla you need to learn to use DOM methods e.g.
      > while (htmlElement.ha sChildNodes()) {
      > htmlElement.rem oveChild(htmlEl ement.lastChild );
      > }
      > htmlElement.app endChild(myFrag ment);[/color]

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

      Thanks


      Comment

      • Martin Honnen

        #4
        Re: hello



        Pampam wrote:
        [color=blue][color=green]
        >>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?[/color][/color]
        [color=blue]
        > I want to show my transform result in a window.alert(), therefore I must
        > convert this to string.[/color]

        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.create Element('div');
        div.appendChild (myFragment);
        alert(div.inner HTML);

        --

        Martin Honnen
        http://JavaScript.FAQTs.com/

        Comment

        • Pampam

          #5
          Re: hello

          > If you want the serialized HTML markup then do[color=blue]
          > var div = document.create Element('div');
          > div.appendChild (myFragment);
          > alert(div.inner HTML);[/color]


          THANKS !!!! its it :)


          Comment

          Working...