XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 11th, 2003, 11:23 AM
woodangela woodangela is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Oklahoma
Posts: 2 woodangela User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to woodangela
Unhappy Using links with XML

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.

Reply With Quote
  #2  
Old September 11th, 2003, 02:31 PM
jharnois's Avatar
jharnois jharnois is offline
mod_dev_shed
Dev Shed God 20th Plane (14500 - 14999 posts)
 
Join Date: Sep 2002
Location: Atlanta, GA
Posts: 14,569 jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level)jharnois User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 Days 22 h 42 m 51 sec
Reputation Power: 835
HTML is CDATA.
Code:
...
<link><![CDATA[<a href="foo.html">foo</a>]]></link>
However, this is often not how you want to do things. The purpose of XML is to describe data and when you use a lot of HTML in CDATA within XML, you're not describing that data well. That's not to say you should never have HTML in XML. Here's how it could look:
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>
You may also try using {link/@href} and {link/@text} instead of making variables out of them first.
__________________
# Jeremy

Explain your problem instead of asking how to do what you decided was the solution.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Using links with XML


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT