...

View Full Version : Very basic XML/XSLT problem



darkshadowx3
06-03-2009, 08:53 PM
Hi there, I'm trying to figure out how to accomplish this seemingly simple task with XML/XSLT, but I can't figure out the best way to go about it.

Here is my XML document, ali.xml:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="layouts/ali.xsl"?>

<alldogs>
<dog>
<title>Ch Wildside's Why Not</title>
<name>Ali</name>
<sex>female</sex>
<breeder>Wildside and Calix</breeder>
<owner>Wildside</owner>
<dob>6/25/01</dob>
<address>ali.xml</address>
<reg>RM350762/02</reg>
<photo>images/thegirls/ali_1.jpg</photo>
<thumbs>images/thegirls/ali_thumb.jpg"></thumbs>
<thumbs>images/thegirls/ali_thumb2.jpg"></thumbs>
</dog>
</alldogs>

As you can see, there are two instances of the <thumbs> element.

What I am trying to accomplish is this: I want the XML page to display each instance of the <thumbs> element automatically on the page using XSL, while at the same time having a standard HREF link to the bigger version of each image. Essentially it will be a little thumbnail gallery generated from the list of <thumb> elements in the document.

What is the best way to go about doing this? Is this even the right structure for what I'm trying to accomplish? I can get the images to populate using a JavaScript For loop, but when I do that I have trouble getting each thumb to properly link to its corresponding image.

Each image will have its own path, and its own URL. I figured their might be an easy way to do this by simply using <template> in XSL, but I'm having a hard time figuring out how I would do it. Any help would be appreciated. Sorry if this sounds really dumb and overcomplicated for what needs to be done.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum