Jump to content
BlueGeek

Problem with Tables in XML

Recommended Posts

This is the kind of question I'm sure gets asked all the time on this forum seeing as it seems to be pretty natural to XML, but after a brief search, I couldn't find it.Anyway, a few weeks back I designed a nice plane old HTML site for someone. Just the other day, I decided to brush up my XML/XSLT skills and make it easier for him to add his own content. The first thing I did was to build an XML file for a news reel on his front page, I then took the HTML and more or less ported it to XSL (essentially just copied the body, put it in an XSL file and removed the content).I previewed it in DreamWeaver (which I'd like to point out renders the XSL to straight HTML) and it looked fine. So I upload it without thinking twice, and when I view it from the site, it's all screwy.To define screwy, first let me explain how the screwy part is structured. The design is essentially a table with three rows, each containing a set of images (comprising a top nav banner). Below is the original layout (in HTML, I've only included the top banner for ease of viewing):http://www.tranessound.com/old.htmland here is what happened when I put it in XSL:http://www.tranessound.com/home_page.xmlI've tried all combinations of defining and not defining sizes in both the table and images, it always ends up the same.I have experience in XML but most of it revolves around functionality, this is the first time I've used it in such a designer context (outside of Flash, anyway) so I'm sure there's a lot I don't know.Thanks in advance-SG

Share this post


Link to post
Share on other sites

I'm not sure if it could be a problem (I actually hope it's not), but... change your <p1> and <s1> elements to <p> and.... <s>?One other problem I may point out. Move your namespace declaration to the root element. That is, turn:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/><xsl:template match="/"><html xmlns="http://www.w3.org/1999/xhtml">

into

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"><xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/><xsl:template match="/"><html>

Or simply remove the xmlns for XHTML.

Share this post


Link to post
Share on other sites

Uh...not sure how it will work with this XSLT, but your XML is using the hp_2.xsl file. You have <p1> and <s1> there. If you want to use index.xsl, in the XML, change

<?xml-stylesheet type="text/xsl" href="hp_2.xsl"?>

to

<?xml-stylesheet type="text/xsl" href="index.xsl"?>

Share this post


Link to post
Share on other sites

... that's weird, it SHOULD be index.xsl already, that's what it shows up as for me...I even just checked it, both my local and remote files show up as being linked to index.xsl... this is kinda like a geekier twilight zone =D (life is awesome...)

Share this post


Link to post
Share on other sites

Upload another remote file (and give the new link) that uses index.xsl.Btw, scince those are news, you would probably want to page the XML (leave only the first few on the page and provide an option for going earlier into the archive). If so, try using my pagination framework to page the file. I've tested it over and over again, so it currently seems stable.

Share this post


Link to post
Share on other sites

yeah, I just remade and reupped it, no luck... I also did happen to make it so only the three appear, that's in the full version though, I cutit down to just the banner so it would be easier to fix this problem first, thanks for the advice and template all the same though =)frustration!

Share this post


Link to post
Share on other sites

Well, I now see it "works" as in "it shows something". What should happen but doesn't (now)?

Share this post


Link to post
Share on other sites

well, if it's not doing this for you than I guess this has just gotten harder to fix... for me (on every computer I try it with) it's showing up as having a white space between each row of the table, only a few pixels high (I'm guessing about 10)

Share this post


Link to post
Share on other sites
well, if it's not doing this for you than I guess this has just gotten harder to fix... for me (on every computer I try it with) it's showing up as having a white space between each row of the table, only a few pixels high (I'm guessing about 10)
Nope. The only difference between your latest version and the old HTML version I see is the + sign standing above the table which pushes it a bit below. I don't see any other difference.

Share this post


Link to post
Share on other sites

What browser are you using? I use IE7 and it's all fine in both versions. There is a small problem in FF's XML version though. But it's not white margins, but more like colorful borders. It could be more of a CSS problem. Try giving the image another z-index and it will look feasable enough. You should try using more CSS then pure HTML anyhow.[edit]FF2.... now I see the problem. Oh well.... it still seems like a CSS issue[/edit]

Share this post


Link to post
Share on other sites

Noted, might be a while with this one, the boss just worked in and this has NOTHING to do with what I'm supposed to be getting payed for at the moment

Share this post


Link to post
Share on other sites

Okay, I'm just gonna admit to being ignorant on this one... how much stuff exactly SHOULD be the CSS, should I be making a different class for each image?

Share this post


Link to post
Share on other sites

More like a different class for each "type" of image and use colors instead of images whenever possible. Also, use plain text for the menu's text, instead of images, etc.It's a general good design practice.Actually, you know what, I think I already know what your problem is. Transformiix (FF's XSLT processor) has a bug which enforces the use of the DTD in a higher priority then the method. So,

<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

Enforces XHTML's MIME type which in turn causes a different default behaviour as well as a few CSS different ones.This however only applies to the "html" method. "xml" method will instead show the XML source, even if there's a DTD and/or the media-type attribute present.To fix this problem, try downgrading the DTD:

<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd"/>

Either that, or simply get yourself an XSLT processor on the server side (that's what I normally do).

Share this post


Link to post
Share on other sites

Gotit.Yeah, about the text, I wanted to but he was pretty insistent on the font which was pretty obscure.Thanks, I'll probably be back sooner than later... Big props Boen

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...