|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Ok...I've read a few previous answers to on this forum and others that are similar to my question, but I just need a little more explanation. Here's the situation.
I want to have an XML document that contains names of photo albums and their links. Example code: <?xml version="1.0" encoding="UTF-8"?> <Photo_Album_Links> <album> <title>Photo Test</title> <link><a href="http://www.kofm.com">PhotoTest</a></link> </album> <album> <title>PhotoTest2</title> </album> <album> <title>phototest3</title> </album> </Photo_Album_Links> I want to be able to add the links to the other albums to my existing photo album page, but I don't want to have to hard code in all the links. I want anyone that has access to the site to be able to ad the links in that they wish just by adding another link to the xml file. How do I do this? and if it is an XSL thing then please give me a working example and tell me how I need to use it in my existing page. here is the attatched file of the existing html page for the album I use. I want the links to the other albums in the far right hand colum under the ad. You will have to scroll down a long way to get to the actual place where I want it. |
|
#2
|
||||
|
||||
|
HTML is CDATA.
Code:
... <link><![CDATA[<a href="foo.html">foo</a>]]></link> Code:
<?xml ...?>
<photo_album_links>
<album title="Title1">
<link href="Title1.html" text="Title1" />
</album>
</photo_album_links>
Code:
<?xml ...?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/photo_album_links">
<xsl:for-each select="album">
<xsl:variable name="href" select="link/@href" />
<xsl:variable name="text" select="link/@text" />
<h1><xsl:value-of select="@title" /></h1>
<p><a href="{$href}">{$text}</a></p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Using links with XML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|