|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
HELP Hyperlinks do not work...
Hi guys,
I am really new to this XML thing but I have a client waiting and I can not figure out how to make my links work... my xml <distributor> <company>NAME</company> <logo path="images/oem-logo.jpg"/> <phone>1-800-999-9999</phone> <email link="xxx@yyy.zzz"/> </distributor> my xslt <a href="{link}">click here</a> I also tried <a href="{@link}">click here</a> and <a href="{$link}">click here</a> what am i doing wrong??? Thanks, Lito
__________________
Sometimes just a few hours of trial and error debugging can save minutes of reading the manual.
|
|
#2
|
|||
|
|||
|
This syntax is the right one :
<a href="{@link}">click here</a> So if it's not working, the only reason I'd see would be that the parser doesn't know to which node the @link attribute belongs.. but if you did something like this, it should work : Code:
<xsl:template match="email">
<a href="{@link}">click here</a>
</xsl:template>
|
|
#3
|
||||
|
||||
|
Thanks for the help...
I tried what you suggested but it wouldn't parse, because it was nested, so finally i figured it out Code:
<a href="{//email/@link}">click here</a>
Cheers. --Lito |
|
#4
|
|||
|
|||
|
yes indeed, the piece of code I provided had to be a template on its own, and couldn't be nested into another template.
The answer you're showing proves I guessed it right. If you have some time, you should read a little about XPath, and make sure you understand the differences between absolute and relative paths; also, keep in mind that when you refer to a node or an attribute, you always do so within a given context. |
|
#5
|
||||
|
||||
|
Thanks,
I am planning on picking up a book here in a day or two. But what a headache --Lito |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > HELP Hyperlinks do not work... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|