CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   XML (http://www.codingforums.com/forumdisplay.php?f=3)
-   -   Creating a table (http://www.codingforums.com/showthread.php?t=285972)

jag157 01-18-2013 12:21 AM

Creating a table
 
Hi there i am creating a blog website through xml and have used xsl to output it and have also used css to style it but i am having problems, i am wanting to create a table for which i can have title, blog text, date, time do i enter the table through css? everytime i do it doesnt load and i have tried everything also i wanted to add a menu and i have tried adding that through css and that doesnt work too, any help much appreciated

edit: thiss is the code for the menu i have tried putting it in css and xsl but it doesnt show up
Code:

div.menu2
{
    /*width:500px;margin:0 auto;*//*Uncomment this line to make the menu center-aligned.*/
    text-align:center;
    background-image: url(bg1.gif);
    border:1px solid black;
    font-size:0;
}

div.menu2 a
{
    display: inline-block;
    padding: 0 20px;
    background-image: url(bg.gif);
    color:White;
    text-decoration:none;
    font: bold 12px Arial;
    line-height: 32px;
}

div.menu2 a:hover, div.menu2 a.current
{
    background-position:0 -60px;
}

div.menu2 a.dummy
{
    width:2px;
    padding:0 0;
}


Alex Vincent 01-18-2013 02:00 AM

Can you post the XML and the XSLT as well, using code tags?

jag157 01-18-2013 02:43 AM

really sorry but didnt know what code tags were my xml is
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Myblog.xsl"?>
<blog>

<blog-item>
<title>Insert title</title>
<text>Blog text here</text>
<date>Insert date</date>
<time>Insert time</time>
</blog-item>

</blog>

my xssl is
Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
<head>
<link rel="stylesheet" type="text/css" href="styling.css" />
</head>
  <body>
  <h1>Jagroop Singh's Blog</h1>
<h2>Middlesex University</h2>
<h3>M00294790</h3>
  <table border="7">
    <tr bgcolor="blue">
      <th>Title</th>
      <th>Text</th>
      <th>Date</th>
      <th>Time</th>
    </tr>
    <xsl:for-each select="blog/blog-item">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="text"/></td>
      <td><xsl:value-of select="date"/></td>
      <td><xsl:value-of select="time"/></td>
    </tr>
    </xsl:for-each>
  </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>

there is a basic table is the xsl but i want to add a more attractive looking one thanks

sunfighter 01-18-2013 05:46 PM

jag157 your style sheet id for a menu (menu2) that is contained in a div. Your xml/xsl does not have any menu or div in it so the stylesheet wont work for it.

Add this to the end of the stylesheet and watch the change in the xml styling.
Code:

h2{
        color: blue;
}
h3{
        color: pink;
}
tr{
        background-color: green;
}

Did you want to add a menu to the html the xsl does?


All times are GMT +1. The time now is 06:31 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.