Click here to Skip to main content
16,010,876 members
Home / Discussions / XML / XSL
   

XML / XSL

 
QuestionWhy won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini12-Jan-06 11:50
R0ssini12-Jan-06 11:50 
AnswerRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini12-Jan-06 11:53
R0ssini12-Jan-06 11:53 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini12-Jan-06 11:56
R0ssini12-Jan-06 11:56 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini12-Jan-06 12:48
R0ssini12-Jan-06 12:48 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
maheshfour30-Jan-06 0:58
maheshfour30-Jan-06 0:58 
AnswerRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
Curtis Schlak.12-Jan-06 12:57
Curtis Schlak.12-Jan-06 12:57 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini12-Jan-06 13:03
R0ssini12-Jan-06 13:03 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
Curtis Schlak.13-Jan-06 3:42
Curtis Schlak.13-Jan-06 3:42 
Okay, lots of things.

First, using an XML datasource in IE to populate a table (as in your HTML file) will not apply the stylesheet to the XML data. Instead, you must put your styles in the TABLE with the DATASRC.

Second, using what you posted, your stylesheet has some incorrect values in it. Remember, XML is case-sensitive. Thus, "cd" and "CD" are different. Here's a stylesheet that will do what you want for the XML file.

XSL file
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <html>
  <body>
  <h2>My CD Collection</h2>
   <table border="1">
      <tr bgcolor="#9acd32">
        <th align="left">Title</th>
        <th align="left">Artist</th>
      </tr>
      <xsl:for-each select="/CATALOG/CD">
      <tr>
        <td><xsl:value-of select="./TITLE"/></td>
        <td><xsl:value-of select="./ARTIST"/></td>
    <td><xsl:value-of select="./COUNTRY"/></td>
    <td><xsl:value-of select="./COMPANY"/></td>
    <td><xsl:value-of select="./PRICE"/></td>
    <td><xsl:value-of select="./YEAR"/></td>
      </tr>
      </xsl:for-each>
    </table>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini13-Jan-06 14:48
R0ssini13-Jan-06 14:48 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
Curtis Schlak.14-Jan-06 2:47
Curtis Schlak.14-Jan-06 2:47 
GeneralRe: Why won't this XML code work? URGENT HELP NEEDED!!! Pin
R0ssini12-Jan-06 13:45
R0ssini12-Jan-06 13:45 
GeneralHTML File Pin
R0ssini12-Jan-06 13:47
R0ssini12-Jan-06 13:47 
GeneralXML File Pin
R0ssini12-Jan-06 13:48
R0ssini12-Jan-06 13:48 
GeneralRe: XSL File Pin
R0ssini12-Jan-06 13:50
R0ssini12-Jan-06 13:50 
QuestionHow to fix "Error Parsing Entityname" Exception Pin
Zenly12-Jan-06 8:36
Zenly12-Jan-06 8:36 
AnswerRe: How to fix "Error Parsing Entityname" Exception Pin
Curtis Schlak.12-Jan-06 10:36
Curtis Schlak.12-Jan-06 10:36 
GeneralRe: How to fix "Error Parsing Entityname" Exception Pin
Zenly12-Jan-06 11:30
Zenly12-Jan-06 11:30 
GeneralRe: How to fix "Error Parsing Entityname" Exception Pin
Curtis Schlak.12-Jan-06 12:55
Curtis Schlak.12-Jan-06 12:55 
GeneralRe: How to fix "Error Parsing Entityname" Exception Pin
Zenly12-Jan-06 14:02
Zenly12-Jan-06 14:02 
GeneralRe: How to fix "Error Parsing Entityname" Exception Pin
Curtis Schlak.13-Jan-06 1:33
Curtis Schlak.13-Jan-06 1:33 
QuestionUnable to Load XML Pin
Samy Lahur11-Jan-06 2:32
Samy Lahur11-Jan-06 2:32 
QuestionGrouping multiple paragraph styles and multiple character styles using xsl Pin
gandhiaryah10-Jan-06 23:28
gandhiaryah10-Jan-06 23:28 
QuestionXML Serialization Pointer Fix uping Pin
asdf98910-Jan-06 9:32
asdf98910-Jan-06 9:32 
QuestionTransform to HTML with javascript Pin
Colin Angus Mackay10-Jan-06 5:18
Colin Angus Mackay10-Jan-06 5:18 
AnswerRe: Transform to HTML with javascript [Quick and dirty workaround] Pin
Colin Angus Mackay10-Jan-06 6:12
Colin Angus Mackay10-Jan-06 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.