Connecting Tech Pros Worldwide Help | Site Map

external url link from an xml document and transforming it...

 
LinkBack Thread Tools Search this Thread
  #1  
Old January 2nd, 2007, 10:14 PM
Newbie
 
Join Date: Jan 2007
Posts: 6
Default external url link from an xml document and transforming it...

Hi,
I am really new to xml and this may sound dumb, but could someone please help me out by providing the code to linking to an external url from an xml file?

Right now I have the xml reading:
...<links><url_text>view larger</url_text> <url>www.domain.com/largerimages/sample.html</url>
</links>...

And I have the xslt document reading:

...<td><a>
<xsl:attribute name="HREF">http://<xsl:value-of select="url"/></xsl:attribute>
<xsl:value-of select="url_text"/></a></td>...

I have read that the following, above the <head> tag should read:
<xsl:template match="links"> but when I put links in the quotations, the whole file seems to disappear...

Thanks for anyone who can help...
Reply
  #2  
Old January 3rd, 2007, 08:26 AM
Newbie
 
Join Date: Jan 2007
Posts: 4
Default

Hi
If you are asking for xml to html conversion,then this might help you.

Expand|Select|Wrap|Line Numbers
  1.   <xsl:template match="/">
  2.     <xsl:for-each select="links">
  3.      <td>      
  4.       <xsl:variable name="url" >
  5.        <xsl:value-of select="url" />
  6.       </xsl:variable>     
  7.       <a href="http://{$url}"><xsl:value-of select="url_text" /></a>
  8.     </td>
  9.     </xsl:for-each>
  10. </xsl:template>
  11.  
Reply
  #3  
Old January 3rd, 2007, 02:10 PM
Newbie
 
Join Date: Jan 2007
Posts: 6
Default

Thank you! That worked perfectly!!!! I was missing a couple of things from my code. Thanks again!!!!

Quote:
Originally Posted by aparna8
Hi
If you are asking for xml to html conversion,then this might help you.

Expand|Select|Wrap|Line Numbers
  1.   <xsl:template match="/">
  2.     <xsl:for-each select="links">
  3.      <td>      
  4.       <xsl:variable name="url" >
  5.        <xsl:value-of select="url" />
  6.       </xsl:variable>     
  7.       <a href="http://{$url}"><xsl:value-of select="url_text" /></a>
  8.     </td>
  9.     </xsl:for-each>
  10. </xsl:template>
  11.  
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.