Results 1 to 6 of 6

Thread: CSS, XML, IE versus Firefox - need advise, please.

  1. #1
    Join Date
    Jul 2008
    Location
    Conesus (Western Finger Lake Region), New York
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question CSS, XML, IE versus Firefox - need advise, please.

    Hey all. I hate my first post to be a plea for help, but... well, I was looking for a solution and found this forum. Searched for a CSS and XML and found nothing.


    I have a page with a field that holds XML generated when the user enters information in a popup input form. I want to use css to simply make the XML readable for the user. No translation, interpretation, etc.

    Knowing diddly about css (I've never done anything out of the ordinary before), I assumed I could apply it to the XML that I insert onto the page.

    This works fine in Firefox, is a little funky in Opera, but doesn't do much of anything in IE7.

    Can anyone tell me what I'm doing wrong?

    XML sent to browser:
    <?xml version="1.0" encoding="utf-8"?><companyData> <company name=""><name>Company Name</name><staffing>Staffing</staffing><workStatus>Work Status</workStatus><deliveries>Deliveries</deliveries><comments>Comments</comments><equipment>Equipment</equipment></company><company name="Training Example Company"><name>Training Example Company</name><staffing>72</staffing><workStatus>On track</workStatus><deliveries>None</deliveries><comments>None</comments><equipment>books</equipment></company><company name="Steel Workers 354.com Inc."><name>Steel Workers 354.com Inc.</name><staffing>19</staffing><workStatus>On schedule</workStatus><deliveries>None</deliveries><comments>Work progressing well. No problems.</comments><equipment>1 crane, 1 generator</equipment></company><company name="Thoma Electric"><name>Thoma Electric</name><staffing>19</staffing><workStatus>Behind schedule by 2 days</workStatus><deliveries>1 case romex</deliveries><comments>three guys called in sick</comments><equipment>panel truck</equipment></company><company name="UseYourClub"><name>UseYourClub</name><staffing>6</staffing><workStatus>Good</workStatus><deliveries>ice Cream</deliveries><comments>noce kids</comments><equipment>Roller skates</equipment></company></companyData>

    Firefox results:


    IE results:



    CSS (as of this moment):
    companyData {display:table; border-collapse: separate; border-spacing: 20px; }
    company {display:table-row; font-family:arial; font-size:90%; color:black; width:5em }
    name {display:table-cell; font-family:arial; font-size:90%; color:blue; width:200px; padding:5px;}
    staffing {display:table-cell; font-family:arial; font-size:90%; color:black; width:50px; padding:5px;}
    workStatus {display:table-cell; font-family:arial; font-size:90%; width:100px; padding:5px;}
    deliveries {display:table-cell; font-family:arial; font-size:90%; width:100px; padding:5px;}
    comments {display:table-cell; font-family:arial; font-size:90%; width:200px; padding:5px;}
    equipment {display:table-cell; font-family:arial; font-size:90%; width:100px; padding:5px;}


    Any words of guidance would be greatly appreciated.

    Thanks,
    Kary

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please post a link to the page on your site that contains the problematic code so we can check it out.


    Or put up a demo page somewhere and give us a link to that.

    I don't see any xslt stylesheet declaration in the main code though. IE 7 will probably require that and a valid xslt stylesheet. The rules vary from browser to browser, but generally with xml/xslt if you follow the standards, IE 7, Opera, and FF will all give good results. Opera and FF do a fairly good job of parsing xml by itself, so that may be why it looks OK to you in those.

    Though there are better explanations, this one is pretty easy to follow:

    http://www.w3schools.com/xsl/xsl_transformation.asp
    Last edited by jscheuer1; 07-17-2008 at 04:03 PM. Reason: add link
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    Kary4th (07-17-2008)

  4. #3
    Join Date
    Jul 2008
    Location
    Conesus (Western Finger Lake Region), New York
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I've made a copy of the application here. Log in using the name "Steve Vendor" and the password "access".

    There is a document in this view that you can open (This is a very old - 9 years - application that I'm moving out of the '90's). It the area named "Work on site," you can see the area that should contain the table.

    Adding the stylesheet, as you suggested, John, has solved my IE problem. At least in that the XML alone (not in the document you see in the linked view) works fine now (link).

    The new code doesn't work within the document, though. I've been looking at this too long. I can't see why it doesn't work within the context of the document. Any more words of genius?

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm not really sure what you are doing there, but it appears as though you are mixing HTML and xml. The three things that spring to mind that might work are showing the xml document in an iframe, object tag, or imported via Ajax.

    Something like:

    Code:
    <iframe src="http://roch.onlineproject.com/DailyReportModifications.nsf/DR.xml" width="860" height="400" scrolling="no" frameborder="0"></iframe>
    Last edited by jscheuer1; 07-18-2008 at 04:51 AM. Reason: ad example
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Iframe is not ideal though, as it is becoming deprecated. Object would be better, but that will throw up a security alert in IE. So you can do this:

    Code:
    <!--[if IE]>
    <iframe src="http://roch.onlineproject.com/DailyReportModifications.nsf/DR.xml" width="860" height="400" scrolling="no" frameborder="0"></iframe>
    <![if !IE]>
    <![endif]-->
    <object type="text/xml" data="http://roch.onlineproject.com/DailyReportModifications.nsf/DR.xml" width="860" height="400"></object>
    <!--[if IE]>
    <![endif]>
    <![endif]-->
    IE will get the iframe, all others the object. If IE 8 overcomes this issue, you will be able to do it like so:

    Code:
    <!--[if lt IE 8]>
    <iframe src="http://roch.onlineproject.com/DailyReportModifications.nsf/DR.xml" width="860" height="400" scrolling="no" frameborder="0"></iframe>
    <![if IE 8]>
    <![endif]-->
    <object type="text/xml" data="http://roch.onlineproject.com/DailyReportModifications.nsf/DR.xml" width="860" height="400"></object>
    <!--[if lt IE 8]>
    <![endif]>
    <![endif]-->
    Then IE 7 and less will get the iframe, IE 8 and all other browsers will get the object.

    If AJAX works, it would be better in some ways, yet requires javascript, which iframe and object do not. I cannot test AJAX as easily though, as it must all be on the same domain.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #6
    Join Date
    Jul 2007
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Probably a bit late for you but if I understand you correctly you want to display xml data in a html page.

    Formatting/parsing xml in to html/css is acheived via XSLT.

    XSLT is a stylesheet language for XML and fairly easy (though not as easy as xhtml or xml).

    see http://www.w3schools.com/xsl/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •