XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 23rd, 2004, 11:00 AM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 47 m 12 sec
Reputation Power: 7
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.

Reply With Quote
  #2  
Old July 23rd, 2004, 11:54 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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>

Reply With Quote
  #3  
Old July 23rd, 2004, 03:48 PM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 47 m 12 sec
Reputation Power: 7
Lightbulb

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

Reply With Quote
  #4  
Old July 24th, 2004, 01:48 AM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
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.

Reply With Quote
  #5  
Old July 26th, 2004, 12:47 PM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 47 m 12 sec
Reputation Power: 7
Thanks,
I am planning on picking up a book here in a day or two. But what a headache

--Lito

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > HELP Hyperlinks do not work...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT