![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Nov 2005
Posts: 4
OS: WinXP Pro
|
I'm new to XML and I'm trying to create a script that reads an ASP file that outputs as XML. The data inside uses the following format:
Code:
<ChatLog> <line> <time>11-26-05 5:34 PM</time> <name>Bob</name> <message>Hello Susan.</message> </line> <line> <time>11-26-05 5:36 PM</time> <name>Susan</name> <message>Why, hello there.</message> </line> </ChatLog> Code:
<b>[ 'DATE' ] 'NAME':</b> 'MESSAGE'<br> Code:
<script>
function refresh(){
setTimeout("refresh()", 500);
createXML();
}
</script>
Last edited by Frogger90 : 11-26-2005 at 08:20 PM. |
|
|
|
|
|
#2 (permalink) |
|
Manager, On the Web
Join Date: Jan 2004
Location: Bracknell, UK
Posts: 929
OS: XP
|
Hi,
Try using this string instead when opening the script. Code:
<script type="text/javascript"> Liam
__________________
![]() My Mother suggested a family outing... so I told her Uncle Bob was gay. (Trevor D.) Never argue with an idiot! They'll bring you down to their level and beat you with experience. --------------------------------------------------------------------------------- A member of the Alliance of Security Analysis Professionals since 2004. |
|
|
|
|
|
#3 (permalink) |
|
Registered User
Join Date: Nov 2005
Posts: 4
OS: WinXP Pro
|
Okay, I tired that & revised my code a bit. It's working somewhat better, I think. However, it prints the lines 23 times, not sure why. Here are the links to the files, tell me what you think could be going wrong.
http://www.pcstudyguide.com/testxml.asp <--view the formatted xml file http://www.pcstudyguide.com/testxml.asp?x=2 <--view the unformatted XML file http://www.pcstudyguide.com/testxsl.xsl <--view the XSL file http://www.pcstudyguide.com/testxml.asp?x=3 <--add a line of chat code to the XML file http://www.pcstudyguide.com/testxml.asp?x=1 <--clears the chatlog, in case it gets too long just run this script If you need to know any of the source for the files, just let me know. Thanks a lot for the help. |
|
|
|
|
|
#5 (permalink) |
|
Manager, On the Web
Join Date: Jan 2004
Location: Bracknell, UK
Posts: 929
OS: XP
|
Hi,
the only thing I can see that doesn't look correct is where you have " -" before several of the lines.. <?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> <script type="text/javascript">function createXML(){ document.clear(); var xmlChat = new ActiveXObject("Microsoft.XMLDOM") xmlChat.async = "false" xmlChat.load("testxml.asp?x=2") var xsl = new ActiveXObject("Microsoft.XMLDOM") xsl.async = "false" xsl.load("testxsl.xsl") document.write(xmlChat.transformNode(xsl)) setTimeout("createXML()", 1000); } createXML();</script> </head> - <body> - <xsl:for-each select="ChatLog/line"> - <b> [ <xsl:value-of select="time" /> ] <xsl:value-of select="name" /> : </b> <xsl:value-of select="message" /> <br /> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> When attempting to validate the code, w3c's validator doesn't like them. Try that. Perhaps that's stopping the code from being formatted correctly. Cheers Liam
__________________
![]() My Mother suggested a family outing... so I told her Uncle Bob was gay. (Trevor D.) Never argue with an idiot! They'll bring you down to their level and beat you with experience. --------------------------------------------------------------------------------- A member of the Alliance of Security Analysis Professionals since 2004. |
|
|
|
![]() |
| Thread Tools | |
|
|