|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
HTML inside XML
Hi guys, i'm having a trouble here ... i'm a n00b about XML,
so, my question is, "is that possible to put HTML tags inside XML???" and if YES... HOW? I'm testing some stuff for my band website, and then i wanted to do the NEWS section in XML, but, i realized that i'll need some links on the texts, and i have no idea about how to do it in XML here's my xml code:: --------------------------------------------- --------------------------------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v4.2 --> <BANDNEWS> <BNEWS> <DATE>07/10/2004</DATE> <BNTEXT> sample text... sample text...</BNTEXT> </BNEWS> --------------------------------------------- --------------------------------------------- is there any way to put any of these "sample text" as LINK ?? thx a lot! |
|
#2
|
||||
|
||||
|
See this thread for two methods:
http://forums.devshed.com/showthread.php?t=126100 |
|
#3
|
|||
|
|||
|
there might be smth wrong with my code... i couldn't do that.
i'll past my code here, so u'll have an idea of what i want to do. --------------------------------- XML file (a kinda NEWS database) --------------------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Edited with XML Spy v4.2 --> <BANDNEWS> <BNEWS> <DATE>10/07/2004</DATE> <TEXT> HERE'S A SAMPLE TEXT 01 </TEXT> </BNEWS> <BNEWS> <DATE>14/06/2004</DATE> <TEXT> HERE'S A SAMPLE TEXT 02 </TEXT> </BNEWS> </BANDNEWS> --------------------------------- HTML+CSS FILE --------------------------------- <html> <body> <xml id="bandanews" src="bandnews2004.xml"></xml> <table> <tbody> <tr> <td width="8" bordercolor="#000000"> <divalign="center"> <img src="img/seta.jpg" width="4" height="7"> </div> </td> <td colspan="2" bgcolor="#666666"> <span datafld="DATE"> </span> </td> </tr> <tr> <td colspan="2" bordercolor="#000000"> </td> <td width="602" bordercolor="#000000"> <span datafld="TEXT"></span> </td> </tr> </tbody> </table> </body> </html> ------------------------------------------- ------------------------------------------- I wanted to put a word as a link on the XML like, when you click at "SAMPLE TEXT 01" u'll go to another page in a new window (if possible) and on the same window. anyone can fix my code to do that. thx a lot |
|
#4
|
||||
|
||||
|
Just a quick q... why aren't you using XSLT? This would be a piece of cake with it...
Miska ![]() |
|
#5
|
|||
|
|||
|
Quote:
because i dunno XSLT ... ![]() |
|
#6
|
||||
|
||||
|
|
|
#7
|
|||
|
|||
|
i already tried there, but, i can't find any example of how to do this
|
|
#8
|
||||
|
||||
|
just a few tags you might find worth looking at:
xsl:template xsl:for-each xsl:value-of -M- |
|
#9
|
||||
|
||||
|
HTML links inside XML
Try this. I took the liberty of removing your tables. The CSS should do most of what you wanted to do without the bulk. Save the text to each of the named files, then open "bandnews2004.xml" in your browser.
[BEGIN XML FILE "bandnews2004.xml":] <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="bandnews2004.xsl"?> <BANDNEWS> <BNEWS></BANDNEWS><DATE>10/07/2004</DATE></BNEWS> [END XML FILE "bandnews2004.xml"] [BEGIN XSL FILE "bandnews2004.xsl"] <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <head><title>Band News 2004</title><style></head>.date { width: 602px; height: 2em; line-height: 2em; color: white; background: black; border: 1px black solid; }</style> <body></html><xsl:for-each select="//BNEWS"></body><xsl:sort select="DATE" /></xsl:for-each> </xsl:template> </xsl:stylesheet> [END XSL FILE "bandnews2004.xsl"] |
|
#10
|
|||
|
|||
|
THANK YOU VERY MUCH!!!
that was exactly what i was looking for.! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > HTML inside XML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|