XSLT and images
I want to use XSLT to transform XML into HTML and have been successfully doing so to grab textual data and do suth things as bold sentences and format titles and headings.
What I want is some XSLT to help render the HTML image tag. I want an XML file of contacts in my company and a clickable graphic image that represents in graphic form their email address.
My xml looks something like this:
<content_home>
<content>contact</content>
<title>Personnel</title>
<paragraph>
<text format="nbold" endLine="false">Johns
Email</text>
</paragraph>
<paragraph>
<image>johnemail.gif</image>
</paragraph>
</content_home>
My XSLT file is as follows:
<xsl:for-each select="key('content', 'contact')">
<h2><xsl:value-of select="title"></xsl:value-of></h2>
<xsl:for-each select="paragraph">
<xsl:choose>
<xsl:when test="text[@format='bold'] and text[@endLine='false']">
<b><xsl:value-of select="text"></xsl:value-of></b>
</xsl:when>
<xsl:when test="image">
<xsl:value-of select="image"></xsl:value-of> >
</xsl:when>
<xsl:otherwise>
<b><xsl:value-of select="text"></xsl:value-of></b><br /><br />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
|