Why won't this XML code work? URGENT HELP NEEDED!!!
-
I'm trying to add some XSL to my XML page. I have checked my CXSL code with XMLSpy and it's well formed. I insert the following line which works fine when I open up the XML file on it's own: However, when I try openoing up my whole html document, it doesn't work. The table comes up, but there's no colour, border adjustments, nothing! Why is this? I've checked websites and even a book and they all say this code is correct. I want to get my XSL inside the HTML file but for some reason it isn't letting me. I have to hand this work in tomorrow morning so please help me quick!
-
This is rediculous, how do I get the code to show up? It's the "xml stylesheet type=text/xsl href="CDCatalog.xsl". I'm hoping as i've written it normally this time without any brackets it'll show up?
-
I'm trying to add some XSL to my XML page. I have checked my CXSL code with XMLSpy and it's well formed. I insert the following line which works fine when I open up the XML file on it's own: However, when I try openoing up my whole html document, it doesn't work. The table comes up, but there's no colour, border adjustments, nothing! Why is this? I've checked websites and even a book and they all say this code is correct. I want to get my XSL inside the HTML file but for some reason it isn't letting me. I have to hand this work in tomorrow morning so please help me quick!
When you post XML/(X)HTML documents, you need to change all the < to < and > to >. Or, you can just check the "Ignore HTML tags in this message (good for code snippets)" checkbox below the textarea. If you post it again, I can take a look at it and maybe help you. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
When you post XML/(X)HTML documents, you need to change all the < to < and > to >. Or, you can just check the "Ignore HTML tags in this message (good for code snippets)" checkbox below the textarea. If you post it again, I can take a look at it and maybe help you. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
When you post XML/(X)HTML documents, you need to change all the < to < and > to >. Or, you can just check the "Ignore HTML tags in this message (good for code snippets)" checkbox below the textarea. If you post it again, I can take a look at it and maybe help you. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
When you post XML/(X)HTML documents, you need to change all the < to < and > to >. Or, you can just check the "Ignore HTML tags in this message (good for code snippets)" checkbox below the textarea. If you post it again, I can take a look at it and maybe help you. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
- Voodoo Child Jimmy Hendrix USA Columbia 9.99 2000 The Wall Pink Floyd USA A and M 14.99 1986 London Calling Clash UK Virgin 13.99 1984 Hotel California The Eagles USA Island 9.99 1990 Shout Tears For Fears UK Columbia 12.99 1984 Blue Monday New Order UK A and M 10.99 1987 Singles The Smiths UK Virgin 12.99 1996 She Sells Sanctuary The Cult USA Island 14.99 1989
-
- Voodoo Child Jimmy Hendrix USA Columbia 9.99 2000 The Wall Pink Floyd USA A and M 14.99 1986 London Calling Clash UK Virgin 13.99 1984 Hotel California The Eagles USA Island 9.99 1990 Shout Tears For Fears UK Columbia 12.99 1984 Blue Monday New Order UK A and M 10.99 1987 Singles The Smiths UK Virgin 12.99 1996 She Sells Sanctuary The Cult USA Island 14.99 1989
-
This code won't work for my XML file. i don't know why. The actual table is being displayed fine but it isn't aligned to the middle and the text and border should be in colour. Hope you can help! :)
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
-
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
-
Thank you Curtis, the code works fine :) I should be alright now but i'll let you know if I have anymore problems. Thanks for your help!
'T was my pleasure. Happy coding! "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
Some expert must be there to help me surely? I'm really panicking over this. Even if you don't think you're right could someone please suggest something?
while posting click the ignore html tags check box at the bottom of the post :-) hope it works