Solved

display an image with fixed width and length

Posted on 2001-06-12
4
221 Views
Last Modified: 2006-11-17
I know how to display an image now, but I don't know how to set its width and length. Can you show me how to write?

[xml document]
<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='viewdata.xsl'?>
<CATAGORY>
<product>
       <name>Black Headlight</name>
       <price>30</price>
       <image>hlight1.gif</image>
</product>
<product>
       <name>Red Headlight</name>
       <price>40</price>
       <image>hlight2.gif</image>
</product>
</CATAGORY>


[viewdata.xsl]
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
  <html>
    <head>
      <title>Test XSL sheet</title>
    </head>
    <body>
      <xsl:for-each select="/CATEGORY/Product">
        <xsl:value-of select="name"/><br/>
        <xsl:value-of select="price"/><br/>
        <img><xsl:attribute name='src'><xsl:value-of select="image"/></xsl:attribute></img>
        <br/><hr/>
      </xsl:for-each>
    </body>
  </html>
</xsl:template>
</xsl:stylesheet>

0
Comment
Question by:yeelan
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
gsatsan earned 100 total points
ID: 6184460
Use this:
<img>
<xsl:attribute name='src'>
  <xsl:value-of select="image"/>
</xsl:attribute>
<xsl:attribute name='height'>100</xsl:attribute>
<xsl:attribute name='width'>200</xsl:attribute>
</img>
0
 

Author Comment

by:yeelan
ID: 6188392
why <img> don't need to write like this?

<xsl:element name="img">  ?
0
 
LVL 2

Expert Comment

by:gsatsan
ID: 6189537
you can yeelan..but it is redundant
0
 

Author Comment

by:yeelan
ID: 6190540
Thank you very much, gsatsan
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now