XSL Conflict
At the moment, I am using Perl to parse XML data with an XSL stylesheet for a website I am making. However, I have run into a conflict that I need to try and get around.
Basically, I need to use data from an XML file for an attribute for an HTML tag.
For example, take a look at this ( made up ) XML file:
Code:<?xml version='1.0' encoding='utf-8'?>
<people>
<person>
<name>Bob</name>
<job>Plumber</job>
<picture>bob.jpg</picture>
</person>
<person>
<name>Cookie Monster</name>
<job>Professional Thief</job>
<picture>monster.jpg</picture>
</person>
<person>
<name>Janet</name>
<job>Pencil Salesman</job>
<picture>janetPencil.jpg</picture>
</person>
</people>
Now, here comes the problem. I want to use the value of 'picture' in an image tag. The following XSL stylesheet won't work:
Code:<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:template match='people'>
<xsl:for-each select='person'>
<b><xsl:value-of select='name' /></b>
<br /><i><xsl:value-of select='job' /></i>
<br /><img src='<xsl:value-of select='picture' />' />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Note that the markup might not be perfect, I wrote it on the fly.
Thanks for any help,
Peyton
