K_Drive Posted March 3, 2007 Share Posted March 3, 2007 I have an XML file with a list of books. The first part of the XML file with one record is at the end of this message.One element in the XML file contains the value that is the name of a bitmap file image. For example: <ImgName>Decade_Of_The_Wolf.bmp</ImageName> I am trying to use this value to display the image on an XSLT-generatred webpage.I am trying to generate the following HTML code in order to display the images when I display the list of books: <img src="Book_Images/Decade_Of_The_Wolf.bmp" /> My first attempt was to do this: <xsl:text><</xsl:text> <xsl:text>img src="Book_Images/</xsl:text><xsl:value-of select="ImgName" /><xsl:text>" /</xsl:text><xsl:text>></xsl:text> My second attempt was to do this: <xsl:value-of select="concat('<', 'img src=', '"', 'Book_Images/')" /><xsl:value-of select="ImgName" /><xsl:value-of select="concat('"', ' ', '/>')" /> Both of these attempts resulted in the correct HTML text for an <img> element appearing on the web page, but the images were not displayed. See the example just below.This is what was displayed on the web page for one of the books: <img src="Book_Images/Decade_Of_The_Wolf.bmp" /> The correct filenames for each book was retreived properly.The XML element name, "ImgName", is correct.The path to the Book_Image directory is correct.The image name is correct.How can I generate XSL code that will produce the <img> element that will display the images for each book in the XML file instead of just the HTML code as text?--------------------------------------------------------------------------------------------------------------------------------------------------Here is the first part of my XML file: <BookList> <Book> <Title PaperOrHard="Hardback">Decade Of The Wolf : Returning The Wild To Yellowstone</Title> <Author> <FirstName>Douglas</FirstName> <MiddleName>W.</MiddleName> <LastName>Smith</LastName> </Author> <Editor> <FirstName>John</FirstName> <MiddleName>Peter</MiddleName> <LastName>Ottoman</LastName> </Editor> <Publisher>Lyons Press</Publisher> <YearPublished>2005</YearPublished> <Edition>2nd</Edition> <NbrOfPages>212</NbrOfPages> <ImgName>Decade_Of_The_Wolf.bmp</ImgName> </Book>.........</BookList> Link to comment Share on other sites More sharing options...
boen_robot Posted March 3, 2007 Share Posted March 3, 2007 Read the first answer of the XSLT FAQ. Link to comment Share on other sites More sharing options...
K_Drive Posted March 4, 2007 Author Share Posted March 4, 2007 Thanks, Mr. Robot.I appreciate the first answer, and also the eighth where I can find more information.K_Drive Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now