|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Reading URLs from XML document
Hi,
I have saved url's in a xml file. Now I want to display the information in the XML file on a web page. I know how to do this but how do I get my URLs read from the XML file to show up as hyper links so that users can click on them and go to the specific url read from the xml file? Please help, TPazz |
|
#2
|
|||
|
|||
|
Maybe you should try with XSLT...
|
|
#3
|
||||
|
||||
|
=)
Sample XML FILE your reading from:
<?xml version="1.0" ?> <?xml-stylesheet type="text/xsl" href="xmltest2.xsl"?> <link> <text>Google</text> <url>http://www.google.com</url> </link> Sample XLS file your using to format etc.... <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl utput method="html" /><xsl:template match="/"> <xsl:for-each select="link"> <p><a href="{url}"><xsl:value-of select="text" /></a></p> </xsl:for-each> </xsl:template> </xsl:stylesheet> i just found the answer out too put i wanted to share =) i don't take the credit on this |
|
#4
|
|||
|
|||
|
Thanks
Thanks for your help! It works great!
|
|
#5
|
||||
|
||||
|
you wouldn't happen to know how to output the contents of a element that has spaces:
example: http://www.teamwarfare.com/xml/view...asp?team=MavCom Notice how the tag "Ladder Name" has spaces - a xsl file won't let you use spaces! i am lost! |
|
#6
|
|||
|
|||
|
Hello Roguegunner. You should visit: http://www.w3schools.com/xml/xml_syntax.asp and read up on XML. In your XML document you have this:
Code:
<ladder name="CoD: North America - Retrieval 4v4"> In XML, ladder is the name of the element, whereas name is an attribute (as you said in a previous posting elsewhere on the site). This is built into XML. If you wanted to select this data in your XML document, you would code: Code:
<xsl:value-of select="team/competitioninformation/ladder/@name" /> If you changed your element so that it was instead: Code:
<ladderName>CoD: North America - Retrieval 4v4</ladderName> Then to select it, you could code this instead: Code:
<xsl:value-of select="team/competitioninformation/ladderName" /> But it would probably end up displaying all the information found inside that element which would be much more than just "CoD: North America - Retrieval 4v4". |
|
#7
|
||||
|
||||
|
Hey Thanks for helping me out =)
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Reading URLs from XML document |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|