You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matthew Smith <ms...@windebt.com> on 2000/08/16 22:06:17 UTC

setting attributes in xsl

	How can I set an atribute in xsl?  Here's an example.. I know this is a
silly example, but I can't really think of a ood one right now and it
illustrates the idea.

<xsl:template match="link">
   <a href="<xsl:value-of select="@url">"><xsl:value-of select="link"></a>
</xsl:template>

	Obviously this doesn't work.  Attributes can't contain html tags.  The only
solution I've seen is:

<xsl:template match="link">
   <xsl:variable name="url"><xsl:value-of select="@url"></xsl:variable>
   <a href="{$url}"><xsl:value-of select="link"></a>
</xsl:template>

	Is this the way it must be done, or is there a more graceful solution?

Thanks,
Matt


Re: setting attributes in xsl

Posted by Zvi <th...@ifrance.com>.
<xsl:template match="link">
   <a href="{@url}"><xsl:value-of select="link"></a>
</xsl:template>

Matthew Smith wrote:

> Why would I spend money on a book when I can just bother you?
>
> -----Original Message-----
> From: Ed Staub [mailto:estaub@mediaone.net]
> Sent: Wednesday, August 16, 2000 3:20 PM
> To: cocoon-users@xml.apache.org
> Subject: RE: setting attributes in xsl
>
> Matthew,
>
> Get a book on XSLT!
>
> In this case, you want to use <xsl:attribute>.
>
> -Ed Staub
>
> -----Original Message-----
> From: Matthew Smith [mailto:msmith@windebt.com]
> Sent: Wednesday, August 16, 2000 4:06 PM
> To: Cocoon List (E-mail)
> Subject: setting attributes in xsl
>
>         How can I set an atribute in xsl?  Here's an example.. I know this is a
> silly example, but I can't really think of a ood one right now and it
> illustrates the idea.
>
> <xsl:template match="link">
>    <a href="<xsl:value-of select="@url">"><xsl:value-of select="link"></a>
> </xsl:template>
>
>         Obviously this doesn't work.  Attributes can't contain html tags.  The only
> solution I've seen is:
>
> <xsl:template match="link">
>    <xsl:variable name="url"><xsl:value-of select="@url"></xsl:variable>
>    <a href="{$url}"><xsl:value-of select="link"></a>
> </xsl:template>
>
>         Is this the way it must be done, or is there a more graceful solution?
>
> Thanks,
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


RE: setting attributes in xsl

Posted by Matthew Smith <ms...@windebt.com>.
Why would I spend money on a book when I can just bother you?

-----Original Message-----
From: Ed Staub [mailto:estaub@mediaone.net]
Sent: Wednesday, August 16, 2000 3:20 PM
To: cocoon-users@xml.apache.org
Subject: RE: setting attributes in xsl


Matthew,

Get a book on XSLT!

In this case, you want to use <xsl:attribute>.

-Ed Staub

-----Original Message-----
From: Matthew Smith [mailto:msmith@windebt.com]
Sent: Wednesday, August 16, 2000 4:06 PM
To: Cocoon List (E-mail)
Subject: setting attributes in xsl


	How can I set an atribute in xsl?  Here's an example.. I know this is a
silly example, but I can't really think of a ood one right now and it
illustrates the idea.

<xsl:template match="link">
   <a href="<xsl:value-of select="@url">"><xsl:value-of select="link"></a>
</xsl:template>

	Obviously this doesn't work.  Attributes can't contain html tags.  The only
solution I've seen is:

<xsl:template match="link">
   <xsl:variable name="url"><xsl:value-of select="@url"></xsl:variable>
   <a href="{$url}"><xsl:value-of select="link"></a>
</xsl:template>

	Is this the way it must be done, or is there a more graceful solution?

Thanks,
Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org



RE: setting attributes in xsl

Posted by Ed Staub <es...@mediaone.net>.
Matthew,

Get a book on XSLT!

In this case, you want to use <xsl:attribute>.

-Ed Staub

-----Original Message-----
From: Matthew Smith [mailto:msmith@windebt.com]
Sent: Wednesday, August 16, 2000 4:06 PM
To: Cocoon List (E-mail)
Subject: setting attributes in xsl


	How can I set an atribute in xsl?  Here's an example.. I know this is a
silly example, but I can't really think of a ood one right now and it
illustrates the idea.

<xsl:template match="link">
   <a href="<xsl:value-of select="@url">"><xsl:value-of select="link"></a>
</xsl:template>

	Obviously this doesn't work.  Attributes can't contain html tags.  The only
solution I've seen is:

<xsl:template match="link">
   <xsl:variable name="url"><xsl:value-of select="@url"></xsl:variable>
   <a href="{$url}"><xsl:value-of select="link"></a>
</xsl:template>

	Is this the way it must be done, or is there a more graceful solution?

Thanks,
Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org