Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

images with XSL

Status
Not open for further replies.

cramd

Programmer
Mar 28, 2001
214
US
XML Pro's:
I am trying to create an XML page that displays one simple image for testing....I've searched and found several examples to work from, but still no luck. Could someone look at this and correct me where I'm wrong--all I get is the broken link symbol in my browser. I am beginning with the basics and will build upon this, once the image is working for me. My image path is C:/Webshpere/images/jx41d.jpg

XML PAGE....
<?xml version=&quot;1.0&quot;?>
<?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;testImage3.xsl&quot; ?>
<img>
<picture location=&quot;/WebsphereWork/images/jx41d.jpg&quot;>
</picture>
</img>


XSL PAGE.......
<?xml version=&quot;1.0&quot;?>
<xsl:stylesheet
version=&quot;1.0&quot;
xmlns:xsl=&quot; xmlns=&quot;

<xsl:template match=&quot;/&quot;>

<IMG BORDER=&quot;0&quot;>
<xsl:attribute name=&quot;src&quot;>
<xsl:value-of select=&quot;./picture/@location&quot;/>
</xsl:attribute>
</IMG>

</xsl:template>
</xsl:stylesheet>


---------------------------------------
Any help from the pro's to a beginner would be appreciated!
cramd
 
This is an off-the-cuff stab (which I haven't tried) but who knows, it might be worth something. :)

Code:
<xsl:template match=&quot;/&quot;>

&quot;/&quot; is the document root (i.e., the entire document) not the XML root element. In the example you give, it seems like you want to match &quot;/img&quot; instead. Give it a shot.

HTH,
harebrain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top