jallen Posted February 5, 2008 Share Posted February 5, 2008 This may sound foolish but I have to ask.....Here is an simple example of what I'm trying to do. XML<familyinfo> <image>some_image.jpg</image> <imagelink>some_page.xml</imagelink><--- (This has the address I wish to use for the link) <description>some information</description></familyinfo> XSLT<xsl:for-each select="familyinfo"> <xsl:element name="image"> <xsl:attribute name="src"> <xsl:value-of select="image" /> <--- (When image is clicked it goes to the link address above) </xsl:attribute> </xsl:element> <xsl:element name="a"> <--- (This ends up linking description and needs to be removed) <xsl:attribute name="href"> <--- (Needs to be removed) <xsl:value-of select="imagelink" /> <--- (Needs to be removed) </xsl:attribute> <--- (Needs to be removed) </xsl:element> <--- (Needs to be removed) <xsl:element name="description"> <xsl:value-of select="description"/> </xsl:element></xsl:for-each> The image works regardless if I use img, or image as the element, but how do I get the link to work by clicking the image?Any help would be appreciated. Link to comment Share on other sites More sharing options...
boen_robot Posted February 5, 2008 Share Posted February 5, 2008 Let's remember how we do it in XHTML, shall we? <a href="some_page.xml"> <img src="some_image.jpg"/> some information</a> This is where we're trying to go, right? If so, than this simple stylesheet should do it perfectly: <xsl:for-each select="familyinfo"><a href="{imagelink}"> <img src="{image}"/> <xsl:value-of select="description"/></a></xsl:for-each> (in practice, I'd use a template instead, but for now, I've used for-each for simplicity's sake) Link to comment Share on other sites More sharing options...
jallen Posted February 5, 2008 Author Share Posted February 5, 2008 Got it! THANK YOU VERY MUCH!!!!. I am looking at the XSLT code so intense I never even thought about XHTML.You are the Man!, or Women! BOEN ROBOT. Link to comment Share on other sites More sharing options...
boen_robot Posted February 5, 2008 Share Posted February 5, 2008 You are the Man!, or Women! BOEN ROBOT.The man... please. I'm a man. I'd hate to be confused with a woman, or worse . Link to comment Share on other sites More sharing options...
jallen Posted February 6, 2008 Author Share Posted February 6, 2008 The man... please. I'm a man. I'd hate to be confused with a woman, or worse .LOL yah that thanks bud! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.