Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-13-2002, 11:49 AM   PM User | #1
piz
Regular Coder

 
Join Date: Jul 2002
Location: Barcelona
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
piz is an unknown quantity at this point
Links with XSL

Hi!

I have an XML Dokument with this values:

<persons>
&nbsp;&nbsp;&nbsp;<name>PaulWB</name>
&nbsp;&nbsp;&nbsp;<website>http://www.yeti-networks.net</website>
&nbsp;&nbsp;&nbsp;<website>http://www.pizzahawai.de</website>
</persons>

Now i am creating an XSL-Stylesheet and I want to display the name in <h1> - that works perfectly.
Code:
<div><b><xsl:value-of select="name"/></b></div>
Now I want to display all elements called website with al link which directs to this website.

How do I do that??
Code:
<a href=""><xsl:value-of select="website"/>'</a>
Like this I get a link, but without Target.

Thx for all help!

Saludo, Paule

By the way... how do I include a stylesheet in the XML-File? Or do I have to use an external stylesheet?

Last edited by piz; 09-13-2002 at 11:51 AM..
piz is offline   Reply With Quote
Old 09-13-2002, 12:14 PM   PM User | #2
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
<a href="{website}">thelink</a>
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 09-13-2002, 12:17 PM   PM User | #3
piz
Regular Coder

 
Join Date: Jul 2002
Location: Barcelona
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
piz is an unknown quantity at this point
No, sorry - it doesn't work.

Do I have to specify something special in the DTD?
piz is offline   Reply With Quote
Old 09-13-2002, 04:18 PM   PM User | #4
Guardian23
New Coder

 
Join Date: Jul 2002
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Guardian23 is an unknown quantity at this point
Well what I'd do, although it's a bit annoying, is this:

<script type="text/javascript">
var links= new Array()
var i=0
<xsl:foreach select="website">
links[i] = "\"" + <xsl:value-of select = "self::node()" /> + "\""
/*is that quite right? the self::node() part?*/
/*the quotes might not need to be placed in quotes, I can't quite remember how the quote thing worked out so they wouldn't create a reference to a non existent variable*/
i++
</xsl:foreach>
for (m=0; m<=links.length; m++) {
document.getElementById("div'sID").innerHTML += "<a href=\"" +links[m] + "\">" + links[m] + "</a>"
}
</script>
That's all I can think of... But I've tried using XSL links in JScript, and
usually something like this goes through ok.

Guardian

Last edited by Guardian23; 09-13-2002 at 04:21 PM..
Guardian23 is offline   Reply With Quote
Old 09-13-2002, 04:33 PM   PM User | #5
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
<a href="{selector}">text</a> is a shortcut for:

<a>
<xsl:attribute name="href>
<xsl:value-of select="selector"/>
</xsl:attribute>
<xsl:text>text</xsl:text>
</a>
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 09-14-2002, 12:28 AM   PM User | #6
piz
Regular Coder

 
Join Date: Jul 2002
Location: Barcelona
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
piz is an unknown quantity at this point
Thx!
That works!

The shortcut doesn't worked, no idea why not.

Saludo, piz
piz is offline   Reply With Quote
Old 09-14-2002, 12:47 AM   PM User | #7
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
What's your XSLT program? IE? Mozilla/Transfomiix? Xalan?

Wouldn't surpise me if IE failed to support it.
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Old 09-18-2002, 09:52 AM   PM User | #8
piz
Regular Coder

 
Join Date: Jul 2002
Location: Barcelona
Posts: 246
Thanks: 0
Thanked 0 Times in 0 Posts
piz is an unknown quantity at this point
I tried it in IE6.
piz is offline   Reply With Quote
Old 09-19-2002, 06:41 PM   PM User | #9
mpjbrennan
Regular Coder

 
Join Date: Jun 2002
Location: Newcastle, England
Posts: 178
Thanks: 0
Thanked 0 Times in 0 Posts
mpjbrennan is an unknown quantity at this point
The shortcut works for me in IE6.

patrick
mpjbrennan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:21 AM.


Advertisement
Log in to turn off these ads.