Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How do I embed a link into the text of an xml element's value?

Reply
Thread Tools

How do I embed a link into the text of an xml element's value?

 
 
Thomas P. Fuller
Guest
Posts: n/a
 
      09-08-2003
Hi,

Thanks in advance for any help in this matter.

I need to embed a link in the text portion of an xml element's value.

For example,

<some_element>
Hi, my name is Tom, and you can find my webpage <URL
link="www.xyz.net/~tom">here</URL>
</some_element>

so when this element is transformed into xhtml (using xsl, of course)
we will see the link properly.

If anyone can offer me a suggestion regarding how to tackle this
issue, I would much appreciate it.

Tom
 
Reply With Quote
 
 
 
 
ted
Guest
Posts: n/a
 
      09-11-2003
If you include the protocol in your link attribute (eg,
http://www.xyz.net/~tom) then you can use this:

<xsl:template match="URL">
<a href="{@link}"><xsl:apply-templates/></a>
</xsl:template>

Otherwise, you'll need to add the "http://" part like this:

<xsl:template match="URL">
<xsl:variable name="myUrl" select="concat('http://', @link)"/>
<a href="{$myUrl}"><xsl:apply-templates/></a>
</xsl:template>




"Thomas P. Fuller" <> wrote in message
news: om...
> Hi,
>
> Thanks in advance for any help in this matter.
>
> I need to embed a link in the text portion of an xml element's value.
>
> For example,
>
> <some_element>
> Hi, my name is Tom, and you can find my webpage <URL
> link="www.xyz.net/~tom">here</URL>
> </some_element>
>
> so when this element is transformed into xhtml (using xsl, of course)
> we will see the link properly.
>
> If anyone can offer me a suggestion regarding how to tackle this
> issue, I would much appreciate it.
>
> Tom
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Link Link Link =?Utf-8?B?REw=?= Windows 64bit 0 05-17-2005 12:15 PM
Re: Link Link Link DANGER WILL ROBINSON!!! Kevin Spencer ASP .Net 0 05-17-2005 10:41 AM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM
Embed link in XML with xmlreadmode.auto Kathryn XML 0 06-03-2004 12:26 AM
how to write some xml into huge xml file into speceific location??? Xenia XML 4 11-25-2003 07:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57