Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Generating an IMG tag >Thread Next - Re: Generating an IMG tag Re: Generating an IMG tagTo: NULL Date: 9/1/2005 10:05:00 PM amahmood5@u... wrote: > Hi all, > > I've got an XML data file, with a <percent> element from 0 to 100. I'd > like the XSL file to translate this into an <img> tag. I'll explain... > > I'd like this <percent> value to be presented graphically. I have a > library of 100 graphics files, called 0.png to 100.png. I'd like the > XSL to translate the <percent> element into part of the graphic file > name, ie > > <img src="images/<percent>.png"> > > So for <percent>10</percent>, the XSL should generate > > <img src="images/10.png"> > > Struggling to do this. Tried the concat XPath function, didn't work. > Tried the xsl:text tag, still no joy. I have to use the > and < > tags to prevent creating badly formed XML. I ended up generating a > perfectly good <img> tag, but as regular text, not a tag :-( > > I'm certain it's possible, just can't work out how. Anyone have any > ideas? As a last resort, I can use xsl:choose with 100 when clauses, > but this isn't exactly efficient! > > Kind regards, > > Anwar > xsl:attribute perhaps. Something like this <img> <xsl:attribute name="concat('images/', percent)"/> </img> Something like that anyway. You can probably fixup the XPath. John | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
