Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2013
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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;
    }
    Last edited by Alex Vincent; 01-18-2013 at 03:00 AM. Reason: Adding code tags

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,461
    Thanks
    1
    Thanked 23 Times in 21 Posts
    Can you post the XML and the XSLT as well, using code tags?
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #3
    New Coder
    Join Date
    Jan 2013
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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
    Last edited by Alex Vincent; 01-18-2013 at 06:06 PM. Reason: adding code tags

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,719
    Thanks
    25
    Thanked 662 Times in 661 Posts
    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?


  •  

    Posting Permissions

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