trippytango Posted January 5, 2012 Share Posted January 5, 2012 Hello, I am working on a XML / XSLT / XPATH piece of coursework for university and it is the first time working with this language. I have the layout working within all browsers in standard HTML as seen here (http://gyazo.com/1f9...e952a05a84ce0aa). Now coming along following the XSLT tutorials on w3schools, i have encountered a issue which messes with my layout and i don't understand this. (http://gyazo.com/b11038cee6b59374b8c1416cc136d877) This was when running the initial XSL file as seen in the address bar, i understand that it won't run properly unless on a server but doesn't correct the layout issues. I also believe that a TEMP file is made due to this not been on the server as seen here (http://gyazo.com/625...a143a0d43f646bb). I was wondering how I could solve the layout issue with my website. This is the XSL file below and it works displaying the data I want for the temp file as shown in image 3. I'm just wondering how to get it to display properly. <?xml version="1.0" encoding="ISO-8859-1"?><!-- DWXMLSource="HolidayHouses.xml" --><!-- Edited by XMLSpy® --><html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Home</title><link href="../Assets/Scripts/Css/layout.css" rel="stylesheet" type="text/css" /><link href="../Assets/Scripts/Css/navbar.css" rel="stylesheet" type="text/css" /></head><body id="Body"><div id="Wrapper"><div id="Header"> <img src="../Assets/Images/Title_Banner.jpg" width="1100" height="120" /> </div> <div id="Navbar"><ul> <li><a href="../index.html">Home</a></li> <li><a href="../houseloc.html">House Locations</a> <ul> <li><a href="london.html">London</a></li> <li><a href="sydney.html">Sydney</a></li> <li><a href="newyork.html">New York</a></li> </ul> </li> <li><a href="../slideshow.html">Slide Show</a> </li> <li><a href="../booking.html">Booking Form</a> </li> <li><a href="../report.html">Report</a> </li></ul></div><div id="ConAd" > <div id="Content"> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="HolidayHomes/House"> <tr> <td><xsl:value-of select="Name"/></td> <td><xsl:value-of select="Rooms"/></td> </tr> </xsl:for-each> </table> </div> <div id="Advert"></div><div id="Footer"> © Holiday Homes for Rent - Reece Thompson N0303435 </div></div></div></body></html> Here is the CSS Data if this is needed: /*This document controls the website layout*//* ----- Layout ----- */#Body {background-image:url(../../Images/Website_Background.jpg);margin: 0px;}#Wrapper {height: 100%;width: 1100px;margin-right: auto;margin-left: auto;}#Header {height: 120px;width: 100%;}#Navbar {height: 30px;width: 100%;line-height: 30px;}/*#Breadcrumb {height: 25px;width: 100%;margin-right: auto;margin-left: auto;float:right;}*/#ConAd {padding-top: 10px;padding-bottom: 20px;background-color: #D4D3D3;overflow:hidden;}#Content {height: 100%;width: 800px;float:left;padding: 10px;}#Advert {height: 100%;width: 260px;float:right;padding: 10px; }#Footer {height: 20px;width: 100%;background-color:#666;margin: 0px;}/* ----- Text Styles ----- */.Content_Title {font-family: calibri;font-size: 20px;color: #000000;font-weight: bold;}.Content_Text {font-family: calibri;font-size: 17px;color: #000000;font-weight: normal;}.Content_Quote {font-family: calibri;font-size: 16px;color: #000000;font-style:italic;}.Content_Advert {font-family: calibri;font-size: 15px;color:#000;font-weight:bold;}#Footer {font-family: calibri;font-size: 16px;color:#FFF;text-align:center;}/* ----- Image Styles ----- */.Image_Center {text-align: center;}.Image_Seperate1 {margin-bottom: 5px;margin-top: 5px;}/*/*This document controls the navigation bar*/ul { /* Whole General Font Section */font-family: Calibri;font-size: 18px;margin: 0;padding: 0;list-style: none;font-weight:bold;}ul li { float: left; margin-right:2.5px;}li ul { display: none; }ul li a { display: block; text-decoration: none; /* underlines text if removed */ color: #FFFFFF; /* border-top: 1px solid #ffffff; /* 1px splits the drop down apart **Not Needed ** */ padding: 0px 20px 0px 20px; /* 0-5px for top and bottom, 20-35px for sides. */ /*background-image:url(Assets/images/Untitled-1.jpg); /* Initial Bar Colour */ margin-left: 5px; white-space: nowrap;}li:hover ul { display: block; position: absolute;}li:hover li { /* Font Size on Drop-Down Menu */ float: none; font-size: 16px;}li:hover a { background:#bf001e; } /* Initial Bar Hover Over */li:hover li a:hover { background: #a4011b; } /* Dropdown Selection Colour Change */ *Edit: Here is the XML Data: <?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="london.xsl"?><HolidayHomes><House Loc="London"> <Name>Ranworth</Name> <Rooms>2-4 Rooms</Rooms> <Description> Blah Blah </Description> <Price>250</Price></House><House Loc="London"> <Name>The Gables</Name> <Rooms>2-4</Rooms> <Description> blah </Description> <Price>325</Price></House> <House Loc="Sydney"> <Name>Coach House</Name> <Rooms>4-6</Rooms> <Description> </Description> <Price>340</Price></House><House Loc="New York"> <Name>The Lodge</Name> <Rooms>2-3</Rooms> <Description> </Description> <Price>295</Price></House> </HolidayHomes> Thank you very much, help will be appreciated and i hope to have this problem solved ASAP. Link to comment Share on other sites More sharing options...
trippytango Posted January 6, 2012 Author Share Posted January 6, 2012 I would like for this to go on record of how much of an idiot I am. Thanks anyway Link to comment Share on other sites More sharing options...
DanielShillock Posted January 9, 2012 Share Posted January 9, 2012 I think you may need to take another shot at displaying your XML. Here is a simple example of how to effectively display your XML as an XHTML webpage. Note the use of templates rather than calling a value-of. https://gist.github.com/1440293 I hope this helpsDaniel Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.