Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1

Thread: xml xpath

  1. #1
    Junior Member
    Join Date
    Nov 2005
    Posts
    4
    Member #
    11947
    Sorry for my noob question on xml.. I'll just get straight to the point. Here's the contents of nexttv.xml:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="nexttv.xsl"?>
    <!DOCTYPE nexttv SYSTEM "nexttv.dtd">
    <nexttv>
    <show showid="i1">
     <name>Lost</name>
     <showdescof id="h1"/>
    </show>
    <show showid="i2">
     <name>X-files</name>
     <showinfoof id="h2"/>
    </show>
    <episode episodeid="e1">
     <info>Season #1 Episode #1: bla bla bla</info>
    </episode>
    <episode episodeid="e2">
     <info>Season #1 Episode #2: wu ka ka ka</info>
    </episode>
    <slot id="s1">
     <showof showid="i1"/>
     <episodeof episodeid="e1"/>
     <date>
      <year>2005</year>
      <month>11</month>
      <day>18</day>
     </date>
     <starttime>
      <hour>17</hour>
      <minute>00</minute>
     </starttime>
     <endtime>
      <hour>18</hour>
      <minute>00</minute>
     </endtime>
    </slot>
    <slot id="s2">
     <showof showid="i1"/>
     <episodeof episodeid="e2"/>
     <date>    
      <year>2005</year>
      <month>11</month>
      <day>18</day>
     </date>
     <starttime>
      <hour>19</hour>
      <minute>00</minute>
     </starttime>
     <endtime>
      <hour>20</hour>
      <minute>30</minute>
     </endtime>
    </slot>
    </nexttv>
    and this one is nexttv.xsl:
    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>
      <title>TV guide - NextTV</title>  
      <link href="main.css" rel="stylesheet" type="text/css" />
     </head>
     <xsl:apply-templates/>
    </html>
    </xsl:template>
    <xsl:template match="nexttv">
    <body>
     <div id="header">
     <h1>NextTV</h1>
     </div>
     <div id="navbar">
      <ul>
       <li><a href="index.php" class="navbarlink">Home</a></li>
       <li id="selected"><a href="tvguide.php" class="navbarlink_selected">TV guide</a></li>
      </ul>
     </div>
     <div>
      <h2 id="mainTitle">TV guide</h2>
     </div>
     <div id="contentBody">
      <p style="padding-top:9px;">
       <table cellpadding="4">
       <tr class="tableHeading">
       <td nowrap="nowrap">Show name</td>
       <td nowrap="nowrap">Episode information</td>
       <td>Date</td>
       <td nowrap="nowrap">Start time</td>
       <td nowrap="nowrap">End time</td>
       </tr>
       <xsl:apply-templates/>
       </table>
      </p>
     </div>
     <div style="padding:9px 9px 0 9px;"> <a href="http://validator.w3.org/check?uri=referer"><img src="images/valid-xhtml10.gif"
      alt="Valid XHTML 1.0 Strict" height="31" width="88" class="borderlessImage" /></a>
     </div>
     <div id="copy">
      <![CDATA[
       Copyright 2005 NextTV corporation. All Rights Reserved.
      ]]>
     </div>
    </body>
    </xsl:template>
    <xsl:template match="slot">
    <tr class="tableData">
    <xsl:apply-templates/>
    </tr>
    </xsl:template>
    <xsl:template match="showinfo">
    </xsl:template>
    <xsl:template match="show">
    </xsl:template>
    <xsl:template match="episode">
    </xsl:template>
    <xsl:template match="showof">
    <td><xsl:value-of select="id(@showid)"/></td>
    </xsl:template>
    <xsl:template match="episodeof">
    <td style="font-size:85%;"><xsl:value-of select="id(@episodeid)"/></td>
    </xsl:template>
    <xsl:template match="date">
    <td nowrap="nowrap"><xsl:value-of select="year"/>-<xsl:value-of select="month"/>-<xsl:value-of select="day"/></td>
    </xsl:template>
    <xsl:template match="starttime">
     <td><xsl:value-of select="hour"/>:<xsl:value-of select="minute"/></td>
    </xsl:template>
    <xsl:template match="endtime">
    <td><xsl:value-of select="hour"/>:<xsl:value-of select="minute"/></td>
    </xsl:template>
    </xsl:stylesheet>
    take note of the line with <xsl:value-of select="id(@showid)"/>. Supposedly this line will link the 2 id together just like in a relational database, and it does. But only in IE. If you view this with mozilla or opera, the show name and episode info is not showing. Anyone care to point out the mistake? Thanks...

  2.  


Remove Ads

Posting Permissions

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

Search tags for this page

xsl tv guide

Click on a term to search for related topics.
All times are GMT -6. The time now is 05:05 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com