Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 20th, 2006, 11:19 AM
Authorized User
 
Join Date: May 2006
Location: Plovdiv, , Bulgaria.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to boen_robot
Default Different Browser Behaviours

Hello,

I used Piefecta's PageMaker(see http://www.positioniseverything.net/...maker_form.php) to generate myself a good layout, instead of starting from scratch. I know it's not something that one should really do, but I though that scince I'll be using XSLT, there won't be any worries for what the XHTML nor the CSS is- I would still be able to redo the whole site without moving a single finger on the per-page contents.

So far, so good. I put some of the contents in their own XML files, and copied the rest in an XSLT template.

When ran on IE it's all fine, when ran in FF I see everything but the body's background color (WTF?) and Opera 9 gives "XSLT Processing failed" which is rather odd.

The XSLT(layout.xsl):
Code:
<?xml version="1.0" encoding="windows-1251"?><!DOCTYPE xsl:stylesheet  [
    <!ENTITY nbsp   " ">
    <!ENTITY copy   "©">
    <!ENTITY reg    "®">
    <!ENTITY trade  "™">
    <!ENTITY mdash  "—">
    <!ENTITY ldquo  "“">
    <!ENTITY rdquo  "”"> 
    <!ENTITY pound  "£">
    <!ENTITY yen    "¥">
    <!ENTITY euro   "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="windows-1251"
doctype-public="-//W3C//DTD XHTML 1.1//EN" doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"/>
<xsl:template match="/">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>Your Page Title Here</title>
        <style type="text/css" media="screen">
        @import url("css/noodle_real.css");
        @import url("css/style.css");
        </style>
<!-- import with quotes and brackets hides css from:
Netscape 4.x
Win IE 3
Win IE 4
Mac IE 4.01
Mac IE 4.5
Konqueror 2.1.2
Win Amaya 5.1
isn't that nice to know? -->
        <xsl:comment><xsl:text disable-output-escaping="yes">[if IE]&gt;</xsl:text>
        <style type="text/css">
        @import url("css/IEstyle.css");
        </style>
        <xsl:text disable-output-escaping="yes">&lt;</xsl:text>![endif]</xsl:comment>
    </head>
    <body>
    <div id="fullheightcontainer">
        <div id="wrapper">
            <div id="outer">
                <div id="float-wrap">
                    <div id="center">
                        <div id="clearheadercenter"></div>
                        <div id="container-center">
                            <xsl:copy-of select="."/>
                        </div>
                        <div id="clearfootercenter"></div>
                    </div>
                    <div id="left">
                        <div id="clearheaderleft"></div>
                        <div id="container-left">
                            <xsl:copy-of select="document('navigation.xml',/)"/>
                        </div>
                    <div id="clearfooterleft"></div>
                    </div>
                </div>
                <div id="right">
                    <div id="clearheaderright"></div>
                    <div id="container-right">
                        <xsl:copy-of select="document('additional.xml',/)"/>
                    </div>
                <div id="clearfooterright"></div>
                </div>
                <div class="clear">&nbsp;</div>
            </div>
            <div id="gfx_bg_middle">&nbsp;</div>
        </div>
        <div id="header">
            <div class="outer_horiz_border">&nbsp;</div>
            <div id="subheader1">
                <p>
                This is Sub-Header #1 (with Fixed Height)
                </p>
            </div>
            <div class="outer_horiz_border">&nbsp;</div>
        </div>
        <div class="clear">&nbsp;</div>
        <div id="footer">
            <div class="outer_horiz_border">&nbsp;</div>
            <div id="subfooter1">
                <p>
                This is Sub-Footer #1 (with Fixed Height)
                </p>
            </div>
            <div class="outer_horiz_border">&nbsp;</div>
        </div>
    </div>
    </body>
</html>
</xsl:template>
</xsl:stylesheet>
style.css
[code]/******************************************
Copyright Notice: Parts of these notes are
© Owen Briggs @ www.thenoodleincident.com
(for the font css file) © Big John @
www.positioniseverything.net and © Paul
O'Brien @ www.pmob.co.uk, all of whom
contributed significantly to the design of
the css and html code.
All other content is © ClevaTreva Designs
******************************************/
/***XXXXXXXXXXXXXXX Primary layout rules XXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX

To change many of the widths/heights requires that other certain values must
also be changed at the same time. For this reason, beside these critical
attributes (or nearby if comment hacks do not allow) are comments with the
calculations as to how to adjust them.

These guidance comments start with /*** and end with ***/

/***
You can delete these if you want, but do not delete MAC Hack comments (see
below).

To change the width of the entire layout, adjust the columns that make up the
total, remembering the borders. Remember, even one small mistake will degrade
or even break the layout, so be very careful!

For spacing within the cols, it's best to apply margins on content elements
inserted into the cols, because padding directly on those col elements will
change their widths, breaking the layout.

Certain hiding hacks have been used extensively in this layout, so here is a
quick explanation of them.

The Safari escape tab hack:
***************************

(used on wrapper, and the 3 backgrounds for Moz
and Opera).

Puts an escape in front of a valid number in the style name to replace a
letter in that name, e.g. \65 is an e. A tab is then inserted (not a space).
The purpose of this hack is to hide some code from Safari. Unfortunately,
some other browsers (like IE) see it for what it should be (but NOT Safari),
and so we must undo the code for those browsers by other hacks.

The Tan hack:
*************

* html .anyelement {rules read only by IE/Win and IE/Mac}

The MAC hack:
*************

(first the active comment you are reading now must be
closed...) ***/

/* \*/

/* */

/***...Back in comment mode now. Anything between those two comment lines
will be hidden from IE/Mac. Don't use any comments within this hack or it will
close prematurely and IE/Mac will begin reading before it should.

The above two hacks are combined so as to feed rules only to IE/Win.

The Holly Hack:
***************

Proper use of backslash escape characters inside property names used in the
Holly hack can further segregate rules to be read by only IE6 from rules for
IE5.x/Win.

These hiding hacks, along with several other fixes, make possible this formerly
impossible layout. It is highly unlikely that new browsers will have any
problem with these valid hiding hacks, and we will have to wait for Microsoft
to release IE7.

If enabled in the PageMaker, the 100% height in the html and body styles makes
the design full height. It also breaks Moz because you should use min-height,
but that doesn't work! Note
how these 100% heights are hidden from IE Mac with
the MAC Hack, otherwise they break it.

XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX ***/
html,body{
margin:0; /*** Do NOT set anything other than a left margin for the page
as this will break the design ***/
padding:0;
border:0;
/* \*/
height:100%;
/* Last height declaration hidden from Mac IE 5.x */
}
body{
background:#33CCFF;
min-width:782px; /*** This is needed for moz. Otherwise, the header and footer will
slide off the left side of the page if the screen width is narrower than the design.
Not seen by IE. Left Col + Right Col + Center Col + Both Inner Borders + Both Outer Borders ***/
text-align:center; /*** IE/Win (not IE/MAC) alignment of page ***/
}
.clear{
clear:both;
/*** these next attributes are designed to keep the div
height to 0 pixels high, critical for Safari and Netscape 7 ***/
height:1px;
overflow:hidden;
line-height:1%;
font-size:0px;
margin-bottom:-1px;
}
* html .clear{height:auto;margin-bottom:0} /*** stops IE browsers from displaying
the clear div/br in the page, as these are for Moz/Opera and
Safari only. If IE 5.x Win DID display these, the page is too high ***/
#fullheightcontainer{
margin-left:auto; /*** Mozilla/Opera/Mac IE 5.x alignment of page ***/
margin-right:auto; /*** Mozilla/Opera/Mac IE 5.x alignment of page ***/
text-align:left; /*** IE Win re-alignment of page if page is centered ***/
position:relative; /*** Needed for IE, othewise header and footer aren't contained
directly above and below the body ***/
width:782px; /*** Needed for Moz/Opera to keep page from sliding to left side of
page when it calculates auto margins above. Can't use min-width. Note that putting
width in #fullheightcontainer shows it to IE and causes problems, so IE needs a hack
to remove this width. Left Col + Right Col + Center Col + Both Inner Border + Both Outer Borders ***/
/* \*/
height:100%;
/* Last height declaration hidden from Mac IE 5.x */
/*** Needed for Moz to give full height design if page content is
too small to fill the page ***/
}
#wrapper{
min-height:100%; /*** moz uses this to make full height design. As this #wrapper
is inside the #fullheightcontainer which is 100% height, moz will not inherit heights
further into the design inside this container, which you should be able to do with
use of the min-height style. Instead, Mozilla ignores the height:100% or
min-height:100% from this point inwards to the center of the design - a nasty bug.
If you change this to height:100% moz won't expand the design if content grows.
Aaaghhh. I pulled my hair out over this for days. ***/
/* \*/
height:100%;
/* Last height declaration hidden from Mac IE 5.x */
/*** Fixes height for non moz browsers, to full height ***/
border-right:1px solid #000000; /*** Sets the external right side border. ***/
border-left:1px solid #000000; /*** Sets the external left side border. ***/
background:#003399; /*** Set background color for side columns for Safari & IE ***/
}
#wrapp\65 r{ /*** for Opera and Moz (and some others will see it, but NOT Safari) ***/
height:auto; /*** For moz to stop it fixing height to 100% ***/
}
/* \*/
* html #wrapper{
height:100%;
}
/* Last style with height declaration hidden from Mac IE 5.x */
/*** Fixes height for IE, back to full height,
from esc tab hack moz min-height solution ***/
#outer{
z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
position:relative; /*** IE needs this or the contents won't show outside the parent container. ***/
margin-left:150px; /*** Critical left col dimension value = left col width ***/
width:478px; /*** Critical left and right col/divider dimension value (moves inversly) = center col width ***/
border-right:1px solid #000000; /*** Sets the internal right side border. ***/
border-left:1px solid #000000; /*** Sets the internal left side border. ***/
background:#00CC66; /*** Sets background of center col***/
/* \*/
height:100%;
/* Last height declaration hidden from Mac IE 5.x */
/*** Needed for full height inner borders in Win IE ***/
}
/*** The next style hack for widths are NOT needed if no internal side borders are needed ***/
* html #outer{ /*** IE5.x/win box model fix ***/
width:480px; /*** Critical left and right col/divider dimension value
(moves inversly) = Center Col Width + Both Inner Borders ***/
w\idth:478px; /*** Critical left and right col/divider dimension value (moves inversly) = Center Col Width ***/
}
#float-wrap{
width:478px; /*** Critical left and right col/divider dimension value (moves inversly) = Center Col Width ***/
margin-right:-1px; /*** Static fix, doesn't change ***/
float:left;
display:inline;
}
#left{
width:152px; /*** Critical left col/divider dimension value = Left Col Width + 1px + One Internal Border Width ***/
float:left;
display:inline;
position:relative; /*** IE needs this or the contents won't show
outside the parent container. ***/
margin-left:-151px; /*** Critical left col/divider dimension value = left col width + one internal border width ***/
}
*>html #left{width:151px;} /*** Fix only for IE/Mac = left col width + one internal border width ***/
#container-left{
width:150px; /*** Critical left col dimension value = left col width - 1px ***/
}
#right{
float:left;
display:inline;
width:152px; /*** Critical right col/divider dimension value = right col width + 2px ***/
margin-right:-150px; /*** Critical right col/divider dimension value = negative right col width ***/
margin-left:-1px; /*** Static fix ***/
position:relative; /*** IE needs this or the contents won't show
outside the parent container. ****/
}
/* \*/
* html #right{
width:152px;
margin-left:0px;
margin-right:-500px;
mar\gin-right:-152px;
}
/* Above style hidden from Mac IE */
/*** These commented-out rules below are there to explain the "Critical" info
     for the rules above, because comments must not appear within the Mac-hack.
     The "rules" below are not active, they are just for teaching purposes.

* html #right{
width:152px; Critical right col/divider dimension value = right col width + one internal border width + 1px ***
margin-left:0px; *** Critical right divider dimension value = a static 0px ***
margin-right:-500px; *** IE5.x/win fix, must be above a critical number, but very high values appear okay ***
mar\gin-right:-152px;
*** Critical right col/divider dimension value = negative (right col width + one internal border width + 1px) ***
}
***/
#container-right{
/* \*/
width:150px;
/* Above hidden from IE-Mac */
/*** Critical right col dimension value = right col width ***/
margin-left:3px; /*** Critical right divider dimension value = one internal border width + 2px ***/
}
/* \*/
* html #container-right{
fl\oat:right;
di\splay:inline;
margin-left:2px;
mar\gin-left:0px;
}
/* Above style hidden from Mac IE */
/*** Above margin left set to = one internal border width + 1px ***/
/*** Static fixes ***/

/*** a Note on the Holly hack: if IE/Win shows bugs it's a good idea to apply the height:1%
     hack to different elements and see if that fixes the problem. Sometimes it may be
     necessary to use "position: relative;" on certain elements, but it's hard to tell in
     advance which elements will need such fixes. ***/
/*** This is a STATIC fix for IE5/Win at the largest text size setting. ***/
/* \*/
* html #left{margin-right:-3px;}
/* Above style hidden from Mac IE */
/*** All the IE fixes that are inside seperate "Mac-hacks" may be grouped within
     just one Mac-hack for convenience if desired. However, each fix must come
     later than the rule it is fixing or the fix itself will be overridden. ***/
#center{
width:478px; /*** Set to = center col width ***/
float:right;
display:inline;
/* \*/
margin-left:-1px;
/* Hidden from IE-mac */
}
/*** clearheader heights are made from header height + borders +
any sidebar box height, less any sidebar intrusion.
Similar calcs for footers. ***/
#clearheadercenter{
height:72px; /*** needed to make room for header in center column ***/
overflow:hidden;
}
#clearheaderleft{
height:72px; /*** needed to make room for header in left column ***/
overflow:hidden;
}
#clearheaderright{
height:72px; /*** needed to make room for header in right column ***/
overflow:hidden;
}
#clearfootercenter{
height:52px; /*** needed to make room for footer in center column ***/
overflow:hidden;
}
#clearfooterleft{
height:52px; /*** needed to make room for footer in left column ***/
overflow:hidden;
}
#clearfooterright{
height:52px; /*** needed to make room for footer in right column ***/
overflow:hidden;
}
#footer{
z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
position:absolute;
clear: both;
width:782px; /*** Set to Left Col + Right Col + Center Col + Both Inner Borders +
Both External Borders ***/

height:52px; /*** = Bottom Margin + One Outer Border + body to footer divider depth +
subfooter1 height + any other subfooter heights ***/
overflow:hidden;
margin-top:-52px; /*** negative height ***/
}
#subfooter1{
color: #FFFFFF;
background:#000000; /*** Background Color of Sub-footer #1 ***/
text-align:center;
margin:0 1px; /*** Margin to show left and right External Borders - all sub-headers and sub-footers ***/
height:50px; /*** sub-footer row height ***/
}
#header{
z-index:1; /*** Critical value for Moz/Opera Background Column colors fudge to work ***/
position:absolute;
top:0px;
width:782px; /*** Set to Left Col (not if left sidebar fully intrudes into header or left sidebar is off)
+ Right Col (not if right sidebar fully intrudes into header or right sidebar is off) + Center Col + Both Inner
Borders (not if any sidebar intrudes into header or footer, or Inner Borders are off) + Both External Borders
(not if external borders are off) ***/
height:72px; /*** = Top Margin + One Outer Border + header to body divider depth +
subheader1 height + any other subheader heights ***/
overflow:hidden;
}
.outer_horiz_border, .sb_outer_horiz_border{
background:#000000;
height:1px;
overflow:hidden;
font-size:0px
}
#subheader1{
background: #990000; /*** Background Color of Sub-header #1 ***/
text-align:center;
margin:0 1px; /*** Margin to show left and right External Borders - all sub-headers and sub-footers ***/
height:70px; /*** sub-header row height ***/
}
#gfx_bg_middle{
top:0px;
position:absolute;
height:100%;
overflow:hidden;
width:478px; /*** = Center Col Width ***/
margin-left:150px; /*** = Left Col Width ***/
background:#00CC66; /*** Set background color for center column for Mozilla & Opera ***/
border-right:1px solid #000000; /*** Sets the internal left side border.
Remove border styles if no Internal Borders. ***/
border-left:1px solid #000000;
border-left:1px solid #000000;
}
* html #gfx_bg_middle{
display:none; /*** Hides the moz fix from IE ***/
}[/cpde]
noodle_real.css
Code:
/*** The contents of this file were (ostensibly) written by Owen Briggs
@ www.thenoodleincident.com, and any Copyright rests with him. No
credit for the work that has gone into researching the use of font
sizes and styles rests with ClevaTreva Designs. 100% Kudos to Owen.
This is an EDITED version of the original! You will want to play with
these settings to make your own style for fonts and color other
bits. ***/

body {
    font-family: verdana, arial, helvetica, sans-serif;
    font-size:100.1%; /*** Don't change this setting. Make all other
font-sizes in % (preferred) or ems ***/
    color:#000000;
    }
a {
    text-decoration: none;
    font-weight: bold;
    outline: none;
    }
a:visited {
    }
a:active {
    }
a:hover {
    text-decoration: underline;
    }
strong, b {
    font-weight: bold;
    }
hr {
    margin: 0px; /* fixes xhtml N6 bug where the hr sits to the left*/
    color: #ccc; /* for ie */
    background-color: #ccc; /* for everyone else */
    height: 1px;
    }
p {
    font-size: 90%;
    line-height: 1.1em;
    margin-top: 1.5em;
    margin-bottom: 1.5em; 
    }
li {
    font-size: 90%;
    line-height: 1.1em;
    margin-top: 0.3em;
    margin-bottom: 0.2em; 
    }
ul {
    margin-top: 1.0em;
    margin-bottom: 1.0em; 
    }
td {
    font-size: 90%;
    }
hr {
    margin-top: 2.0em;
    margin-bottom: 2.0em;
    }
img {
    border: 0;
    }
/*** the following styles and notes are © Copyright
Big John @ www.positioniseverything.net ***/
div,p{margin:0}

.italics-test, .italics-test-side {
font-style: italic; 
text-align: justify; 
}

/***
The following fixes prevent justified italic text
from destroying the layout in IE/win. The problem
is that those properties together make IE force the
container wider, which in this type of floated layout
causes a float drop.
Pre-IE6 gets "width: 100%" and "overflow: hidden",
while IE6 gets "width: auto" and "overflow: visible,
which is the default, but explicitly stating it seems
to keep IE6 happy. IE6 also needs to see the
"height: 1%" to give it some kind of box dimension.
Browser coddling we call it. Finally, Bruno Fassino
found that "word-wrap: break-word;" disarranged the
justified text in IE5.5 and 6, so it is defaulted to
"normal" for this text.
If you don't need justified and italicized text then
forget all these fixes.
Although, ClevaTreva adds, I have seen some odd
behavior with normal justified text in IE, so
this may be worth remembering.
***/

/* \*/
* html .italics-test, * html .italics-test-side {
overflow: hidden;
width: 100%;
o\verflow: visible;
w\idth: auto;
he\ight: 1px;
word-wrap: normal;
}
/* */
Not that it matters, but just to avoid the question of it, here's the IEstyle.css
Code:
/*** The rule below prevents long urls from widening floated cols and breaking the layout
     in IE. It is not W3C valid, but if placed within a "Conditional comment" it will be hidden
     from all user agents other than IE/Win, and thus validate. This fix fails in IE5/Win.
     http://msdn.microsoft.com/workshop/a...omment_ovw.asp ***/
#outer{word-wrap:break-word;}
The XML files all contain only a single paragraph and some content in it simply because I'm still outlining the stuff. Something like:
Code:
<?xml version="1.0" encoding="windows-1251"?>
<?xml-stylesheet type="text/xsl" href="layout.xsl"?>
    <p>
    This is the<br />
    Main Content<br />
    </p>

Any idea on what might treat theese odd behaviours from FF and Opera? Could they be some sort of browser bugs or there's something wrong with my approach? If they are browser bugs, what might trigger them? What should I report to Opera and Mozilla?

When parsing this on the server side, it seems the parser doesn't like my style element in the conditional IE comment. Removing it however doesn't make any difference in how browsers behave on the client side though it does display the server side generated page fine everywhere. However I'll probably use XSLT on the client side, so that's not a solution.
__________________
------
&lt;xsl:for-each select=\"problem\"&gt;&lt;xsl:value-of select=\"solution\"&gt;&lt;/xsl:for-each&gt;
Reply With Quote
  #2 (permalink)  
Old May 22nd, 2006, 11:41 AM
Authorized User
 
Join Date: May 2006
Location: Plovdiv, , Bulgaria.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to boen_robot
Default

Thanks for the replyes, I thank you very much:( (yes, I'm being very sarcastic).

Just incase anyone notices the same issues:
Up to the current Opera 9 beta release at least, Opera doesn't support the document() function causing it to return errors. There was also a minor problem with my conditional comment, but nothing that serious.

At mozilla they say that according to the XHTML specification, the background of the document should be set on the root element (html) instead of the body element, so that's not suppose to be a bug. I wonder what they'll say on my last reply as to how come equivalent XHTML Strict documents do get their backgrounds... anyway. The workaround is to simply use background on the html element, so it's not a big loss.

If someone could lock this topic maybe, or does anyone have some comments?

<xsl:for-each select="problem"><xsl:value-of select="solution"></xsl:for-each>
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
browser name annaski PHP How-To 1 February 21st, 2008 06:38 AM
Launch default browser in a new browser window haiying Beginning VB 6 1 August 30th, 2005 05:48 PM
Refreshing Frames Behaviours using F5 (IE only) mat41 HTML Code Clinic 0 July 25th, 2005 06:15 PM
browser crmpicco HTML Code Clinic 6 July 20th, 2005 05:20 AM
not getting o/p on browser ajit_kunte BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 2 May 10th, 2005 02:17 AM



All times are GMT -4. The time now is 11:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.