|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Referencing Data: Simple Newbie Question
I'm trying to do something that I would think would be fairly straightforward-- reference urls stored in a xml file. The xml file is of the following format (using google for example):
<item> <name>Google</name> <link>http://www.google.com</link> </item> So how would I reference this in HTML so that it outputs a list of names that take you to the links? Is this even possible? Just curious |
|
#2
|
|||
|
|||
|
Here is a short example of one way of doing it.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item" >
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select= "./link" />
</xsl:attribute>
<xsl:value-of select="./name" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
|
|
#3
|
|||
|
|||
|
Wow! Thanks alot. It works great.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Referencing Data: Simple Newbie Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|