PDA

View Full Version : Displaying Images in XML


kraftomatic
12-29-2003, 08:31 PM
How do you do it? Can I just have something like:

<Image><img src="images/imageName.jpg"></Image>

.. and reference it in the XSL file? Upon initial trial, this doesn't work.

Thanks.

me'
12-29-2003, 10:49 PM
Depends on what XML language you're using, and where you want to include the images. Say you're writing documentation and want to include an example. <section>
<section-header>Lorem Ispum</section-header>
<paragraph>Lorem ipsum dolor sit amet...</paragraph>
<paragraph>Lorem ipsum dolor sit amet...</paragraph>
<paragraph>Lorem ipsum dolor sit amet
<figure id="1.1" href="image.gif" height="10" width="10"/>
</paragraph>
</section>with some XSLT:<xsl:for-each select="section">
<h2><xsl:value-of select="section-header"/></h2>
<xsl:for-each select="paragraph">
<xsl:value-of select="."/>
<xsl:for-each select="figure">
<img src="@href" height="@height" width="@width"/>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>