You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by li...@bi.no on 2000/05/30 16:41:39 UTC

how can I define a hyper link in xslt?

We use <a href="http://somedomain.com">somedomain</a> to define a hyper link in
HTML. In the xml file, I have an element called "url" which is used to store the
links. How can I make a style sheet to transfer the data into clickable hyper
link in html?

In the style sheet, I tried <a href=xsl:value-of select="url"/></a> , failed
with an exception. Any ideas are appreciated.



Re: how can I define a hyper link in xslt?

Posted by Paul Russell <pa...@luminas.co.uk>.
On Tue, May 30, 2000 at 04:41:39PM +0200, ling.shi@bi.no wrote:
> In the style sheet, I tried <a href=xsl:value-of select="url"/></a> , failed
> with an exception. Any ideas are appreciated.

Close be no cigar ;)

  <a href="{url}"><xsl:value-of select="url"/></a>

Just for future reference, in case you've not found it yet,
the XSLT spec is at: <URL:http://www.w3.org/TR/xslt>.

Hope that helps,


-- 
Paul Russell                               <pa...@luminas.co.uk>
Technical Director,                   http://www.luminas.co.uk
Luminas Ltd.

Re: how can I define a hyper link in xslt?

Posted by Echoes <ec...@free.fr>.
ling.shi@bi.no wrote:
> 
> We use <a href="http://somedomain.com">somedomain</a> to define a hyper link in
> HTML. In the xml file, I have an element called "url" which is used to store the
> links. How can I make a style sheet to transfer the data into clickable hyper
> link in html?
> 
> In the style sheet, I tried <a href=xsl:value-of select="url"/></a> , failed
> with an exception. Any ideas are appreciated.

 use  xsl:element :

<xsl:element name="a">
   <xsl:attribute name="href">
      <xsl:value-of select="url"/>
   </xsl:attribute>
</xsl:element>

 I think you can also achieve this with xsl:variable
 
	Fabrice

Re: how can I define a hyper link in xslt?

Posted by Alistair Hopkins <al...@berthengron.co.uk>.
there is a special construction for value-of inside an element
  just use { and }

as in:

<A class="marknav" href="{@url}" target="MAIN"><xsl:value-of 
select="@text"/></A>

for <link url="www.boo.com" text="Flying Dutchman">

At 04:41 PM 5/30/00 +0200, you wrote:
>We use <a href="http://somedomain.com">somedomain</a> to define a hyper 
>link in
>HTML. In the xml file, I have an element called "url" which is used to 
>store the
>links. How can I make a style sheet to transfer the data into clickable hyper
>link in html?
>
>In the style sheet, I tried <a href=xsl:value-of select="url"/></a> , failed
>with an exception. Any ideas are appreciated.
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: cocoon-users-help@xml.apache.org