View Full Version : how do create both image/text link in xsl..??

10-02-2002, 07:04 AM
how do create a image link in xsl..??
for example, how to write a xsl that both accepts text and image from an input field and display it as an image link if image is inserted, else will display text link if text is inserted...??

10-12-2002, 07:50 PM
Since I am not familar with how your images are being stored, or how you plan on determining what's an image, verse just plain text - I'm flying kinda blind, but this is what I can offer up:

Might be better off passing the return value from your INPUT element to a script that does an If...Exists on the file ( to see if it's a valid image ) and either inserts a <IMG> back into the document or straight text.

Then you just need a <DIV> tag in your HTML that has an ID, you reference in your script and do a call to the DOM method innerHTML, to insert your value.

Through XSL ... you might be able to work something out with <xsl:choose> statements, but again, since I do not know how your images are stored, I'm not certain how you'll validate the text is a valid image or just "text".

If you can expand more on your situation, it might help.