Image link in XML

Asked

Viewed 859 times

2

What I need:

  1. Using an image contained in a link posted on the Internet.
  2. Apply a URL located inside my database.

<xsl:for-each select="/Msg/Props/">
<table>
<tr>
<td align="center" valign="top" width="200">
<a style="text-decoration: none; width:100%;">
	<xsl:attribute name="href">
		<xsl:value-of select="Prop[@prop_name = 'url']/@val" />
	</xsl:attribute> 
	<img border="0" style="height: 120px; width: 150px;">
		<xsl:attribute name="src">
           <xsl:value-of select="Prop[@prop_name = 'foto']/@val" />
<!--####--> Preciso substibuir a FOTO pela minha URL de imagem publicada na net####  -->
		</xsl:attribute>
	</img>
			
</a>
</td>
</tr>
</table>
</xsl:for-each>

Is there any way to do that?

  • Do you have something ready already, or are you starting from scratch? Exemplifying code is always good.

  • Caio, good morning! I managed to post the information.

  • I was able to enter the image URL, but the link didn’t work: <tr> <td align="center" valign="middle"> <a style="text-decoration: none; width:100%;"> <xsl:attribute name="href"> <xsl:value-of select="Prop[@prop_name = 'oferta.url']/@val" /> </xsl:attribute> <noXml> <img src="http://namwpm.eccmp.com/wpm/545/img/ver_detalhes.jpg"/> </noXml> </a> </td>&#xA;</tr>

  • You need to know the XML source to answer XSLT questions. Ideal is also to include the entire XSLT, as the Xpath paths refer to the template. Post to XML source, the XSLT complete and the expected result that I can show you one or more solutions.

  • The code you posted above is creating: <tr><td...><a href="VALOR"><noXml><img ...></noXml></a></td></tr> where VALOR is in <Msg><Props><Prop prop_name="oferta.url" val="VALOR">...</Prop>...</Props>...</Msg> . That is, you are selecting based on an attribute, to extract the value of another, in the same element. If the link did not work (and if it should work) you may not have selected the correct element. Post the source code.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.