xml, xsl, css ... in netscape

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

    xml, xsl, css ... in netscape

    Hi, all.
    i try to use xsl to show xml in IE6+ and NN7+

    i got:

    index.htm

    <html>
    <head>
    <title>Untitl ed Document</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <link rel="stylesheet " href="./css/style.css">

    <script language="JavaS cript">
    function init(){

    //here is checking of browser -> type is IE or
    NN
    var docXML = initXML(type);
    var docXSL = initXML(type);

    if (type == "NN"){
    var count = 0;
    docXML.onload = transform;
    docXML.load(tes t.xml);
    docXSL.onload = transform;
    docXSL.load(tes t.xsl);

    }
    else if (type == "IE"){
    docXML.async = false;
    docXML.load(tes t.xml);
    docXSL.async = false;
    docXSL.load(tes t.xsl);
    document.write( docXML.transfor mNode(docXSL));
    }

    function transform(){
    count++;
    if (count == 2){
    var xsltProcessor = new XSLTProcessor() ;
    var outdoc = initXML(type);
    xsltProcessor.t ransformDocumen t(docXML,
    docXSL, outdoc, null);


    document.write( outdoc.document Element.innerHT ML);
    }
    }
    }

    </script>
    </head>
    <body bgcolor="#EFEFE F">
    <script language="JavaS cript"> init(); </script>
    </body>
    </html>

    test.xsl:

    <?xml version="1.0" encoding="ISO-8859-2"?>
    <xsl:transfor m xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:template match="root">
    <html>
    <head />
    <body bgcolor="#EFEFE F">

    <table bordercolor="#f fffff" cellspacing="0" width="98%"
    bordercolorligh t="#6b5c35" border="1" cellpadding="0" >
    <tr>
    <td align="center" class="captionX SL"> TEST </td>
    </tr>
    </table>
    ...
    </body>
    </html>
    </xsl:template>
    </xsl:transform>

    style.css

    ..captionXSL {
    font: 12px Arial;
    font-weight: bold;
    }

    in IE it all works OK.
    styles define in style.css are used in transformation of XML with XSL in
    HTML

    but in NN
    there is no styles. It shows all needed data but it didn't read and apply
    styles.

    i hope you will help me.

    thanks



  • Oleg Tkachenko

    #2
    Re: xml, xsl, css ... in netscape

    mali djuro wrote:
    [color=blue]
    > <html>
    > <head>
    > <title>Untitl ed Document</title>
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=iso-8859-1">
    > <link rel="stylesheet " href="./css/style.css">
    >
    > <script language="JavaS cript">
    > function init(){
    >
    > //here is checking of browser -> type is IE or
    > NN
    > var docXML = initXML(type);
    > var docXSL = initXML(type);
    >
    > if (type == "NN"){
    > var count = 0;
    > docXML.onload = transform;
    > docXML.load(tes t.xml);
    > docXSL.onload = transform;
    > docXSL.load(tes t.xsl);
    >
    > }
    > else if (type == "IE"){
    > docXML.async = false;
    > docXML.load(tes t.xml);
    > docXSL.async = false;
    > docXSL.load(tes t.xsl);
    > document.write( docXML.transfor mNode(docXSL));
    > }
    >
    > function transform(){
    > count++;
    > if (count == 2){
    > var xsltProcessor = new XSLTProcessor() ;
    > var outdoc = initXML(type);
    > xsltProcessor.t ransformDocumen t(docXML,
    > docXSL, outdoc, null);
    >
    >
    > document.write( outdoc.document Element.innerHT ML);[/color]

    But should it work at all? You are replacing current page's content with
    completely different one, which doesn't have link to css.
    PS. Why not using <?xml-stylesheet PI?
    --
    Oleg Tkachenko

    Multiconn Technologies, Israel

    Comment

    • mali djuro

      #3
      Re: xml, xsl, css ... in netscape


      "Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
      news:eVPGF5UcDH A.384@TK2MSFTNG P12.phx.gbl...[color=blue]
      > mali djuro wrote:
      >[color=green]
      > > <html>
      > > <head>
      > > <title>Untitl ed Document</title>
      > > <meta http-equiv="Content-Type" content="text/html;
      > > charset=iso-8859-1">
      > > <link rel="stylesheet " href="./css/style.css">
      > >
      > > <script language="JavaS cript">
      > > function init(){
      > >
      > > //here is checking of browser -> type is IE[/color][/color]
      or[color=blue][color=green]
      > > NN
      > > var docXML = initXML(type);
      > > var docXSL = initXML(type);
      > >
      > > if (type == "NN"){
      > > var count = 0;
      > > docXML.onload = transform;
      > > docXML.load(tes t.xml);
      > > docXSL.onload = transform;
      > > docXSL.load(tes t.xsl);
      > >
      > > }
      > > else if (type == "IE"){
      > > docXML.async = false;
      > > docXML.load(tes t.xml);
      > > docXSL.async = false;
      > > docXSL.load(tes t.xsl);
      > >[/color][/color]
      document.write( docXML.transfor mNode(docXSL));[color=blue][color=green]
      > > }
      > >
      > > function transform(){
      > > count++;
      > > if (count == 2){
      > > var xsltProcessor = new[/color][/color]
      XSLTProcessor() ;[color=blue][color=green]
      > > var outdoc = initXML(type);
      > >[/color][/color]
      xsltProcessor.t ransformDocumen t(docXML,[color=blue][color=green]
      > > docXSL, outdoc, null);
      > >
      > >
      > > document.write( outdoc.document Element.innerHT ML);[/color]
      >[/color]
      [color=blue]
      > But should it work at all? You are replacing current page's content with
      > completely different one, which doesn't have link to css.[/color]

      It works, under IE6, and in NN7 it doesn't shows styles.
      but when i remove <html>,<head> and <body> tags from test.xsl
      in NN7 there is no data, it is just blank page with word undefined in upper
      left corner.
      [color=blue]
      > PS. Why not using <?xml-stylesheet PI?[/color]

      i try to avoid it, because i made xml generator with no possibility to set
      PI.
      and now i would like to use it here if it is possible.
      thanks
      [color=blue]
      > --
      > Oleg Tkachenko
      > http://www.tkachenko.com/blog
      > Multiconn Technologies, Israel
      >[/color]


      Comment

      • Oleg Tkachenko

        #4
        Re: xml, xsl, css ... in netscape

        mali djuro wrote:[color=blue]
        > It works, under IE6, and in NN7 it doesn't shows styles.
        > but when i remove <html>,<head> and <body> tags from test.xsl
        > in NN7 there is no data, it is just blank page with word undefined in upper
        > left corner.[/color]
        What if you insert <link rel="stylesheet " href="./css/style.css"> into
        test.xsl? I mean if you new generated HTML doesn't contain a link to CSS, so
        why styles should work?
        --
        Oleg Tkachenko

        Multiconn Technologies, Israel

        Comment

        • mali djuro

          #5
          Re: xml, xsl, css ... in netscape


          "Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
          news:O4wBvlVcDH A.2308@TK2MSFTN GP12.phx.gbl...[color=blue]
          > mali djuro wrote:[color=green]
          > > It works, under IE6, and in NN7 it doesn't shows styles.
          > > but when i remove <html>,<head> and <body> tags from test.xsl
          > > in NN7 there is no data, it is just blank page with word undefined in[/color][/color]
          upper[color=blue][color=green]
          > > left corner.[/color][/color]
          [color=blue]
          > What if you insert <link rel="stylesheet " href="./css/style.css"> into
          > test.xsl? I mean if you new generated HTML doesn't contain a link to CSS,[/color]
          so[color=blue]
          > why styles should work?[/color]

          i am confused too. only reasonbly explanation is that with transformation i
          got
          just element, not a whole document. and it pass in IE.

          [color=blue]
          > --
          > Oleg Tkachenko
          > http://www.tkachenko.com/blog
          > Multiconn Technologies, Israel
          >[/color]


          Comment

          • Oleg Tkachenko

            #6
            Re: xml, xsl, css ... in netscape

            mali djuro wrote:
            [color=blue]
            > i am confused too. only reasonbly explanation is that with transformation i
            > got
            > just element, not a whole document. and it pass in IE.[/color]

            Well, actually I wanted to say that generated HTML document doesn't have any
            link to CSS, right? So this looks to me like your problem. Have you tried to
            add link to XSL:

            <xsl:template match="root">
            <html>
            <head>
            <link rel="stylesheet " href="./css/style.css">
            </head>
            <body bgcolor="#EFEFE F">
            --
            Oleg Tkachenko

            Multiconn Technologies, Israel

            Comment

            • mali djuro

              #7
              Re: xml, xsl, css ... in netscape


              "Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
              news:OZGXKIWcDH A.3248@tk2msftn gp13.phx.gbl...[color=blue]
              > mali djuro wrote:
              >[color=green]
              > > i am confused too. only reasonbly explanation is that with[/color][/color]
              transformation i[color=blue][color=green]
              > > got
              > > just element, not a whole document. and it pass in IE.[/color]
              >
              > Well, actually I wanted to say that generated HTML document doesn't have[/color]
              any[color=blue]
              > link to CSS, right? So this looks to me like your problem. Have you tried[/color]
              to[color=blue]
              > add link to XSL:
              >
              > <xsl:template match="root">
              > <html>
              > <head>
              > <link rel="stylesheet " href="./css/style.css">
              > </head>
              > <body bgcolor="#EFEFE F">[/color]

              yes, i tried it,
              but in this case, even in IE,
              styles are not applied

              [color=blue]
              > --
              > Oleg Tkachenko
              > http://www.tkachenko.com/blog
              > Multiconn Technologies, Israel
              >[/color]


              Comment

              • Oleg Tkachenko

                #8
                Re: xml, xsl, css ... in netscape

                mali djuro wrote:
                [color=blue][color=green]
                >><xsl:templa te match="root">
                >> <html>
                >> <head>
                >><link rel="stylesheet " href="./css/style.css">
                >> </head>
                >> <body bgcolor="#EFEFE F">[/color]
                >
                >
                > yes, i tried it,
                > but in this case, even in IE,
                > styles are not applied[/color]

                Hmmm, chances are that ./css/style.css is not resolved properly in that case -
                can you try with absolute URL like <link rel="stylesheet "
                href="http://foo.com/css/style.css"> ?

                --
                Oleg Tkachenko

                Multiconn Technologies, Israel

                Comment

                • mali djuro

                  #9
                  Re: xml, xsl, css ... in netscape


                  "Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
                  news:eLhhpFfcDH A.1072@TK2MSFTN GP12.phx.gbl...[color=blue]
                  > mali djuro wrote:
                  >[color=green][color=darkred]
                  > >><xsl:templa te match="root">
                  > >> <html>
                  > >> <head>
                  > >><link rel="stylesheet " href="./css/style.css">
                  > >> </head>
                  > >> <body bgcolor="#EFEFE F">[/color]
                  > >
                  > >
                  > > yes, i tried it,
                  > > but in this case, even in IE,
                  > > styles are not applied[/color]
                  >
                  > Hmmm, chances are that ./css/style.css is not resolved properly in that[/color]
                  case -[color=blue]
                  > can you try with absolute URL like <link rel="stylesheet "
                  > href="http://foo.com/css/style.css"> ?
                  >[/color]

                  hi,
                  i found out how to applied styles in NN. i used a little bit of everithing
                  and mixed and now it works. but i still have problems.
                  it is not problem that stops program or breaks it, but it borders me.
                  when i make transformations , and if i call some javascript functions inside
                  it, for example i have function to generate navigation menu in pages, and
                  when i call it, menu is written but NN never stops loading page. when i stop
                  loading and view sourcd page, i found out that code of menu is written
                  behind </html> tag.
                  if you have some experience in this or now how to solve it, plesae help.

                  thanks.

                  here is xsl file with that function

                  test.xsl:

                  ....
                  <html>
                  <head>
                  <meta http-equiv="Content-Type" content="text/html;
                  charset=iso-8859-1" />
                  <link rel="stylesheet " href="./css/menu.css" />

                  <script language="JavaS cript"
                  src="./menu/menu.js"></script>
                  </head>

                  <body bgcolor="#EFEFE F">

                  <script language="JavaS cript">
                  make_menu();
                  </script>

                  .....


                  page source is:

                  ...
                  </table>
                  </body>
                  </html>
                  <a id="e0_0o" class="oout" href="main.htm" style="position :
                  absolute; top: 11px; left: 10px; width: 149px; height: 24px; visibility:
                  hidden; z-index: 0;" onclick="return A_MENUS[0].onclick(0);"
                  onmouseout="A_M ENUS[0].onmouseout(0); "
                  onmouseover="A_ MENUS[0].onmouseover(0) ;"
                  onmousedown="A_ MENUS[0].onmousedown(0) ;"><div id="e0_0i"
                  class="iout">ma in</div></a>
                  <a id="e0_1o" class="oout" href="" style="position : absolute; top:
                  11px; left: 159p
                  .....
                  [color=blue]
                  > --
                  > Oleg Tkachenko
                  > http://www.tkachenko.com/blog
                  > Multiconn Technologies, Israel
                  >[/color]


                  Comment

                  Working...