Re: Dynamic attributes from XSL (Sterling you might help)
| From: | Sander Roobol | Date: | Sat, 24 May 2003 17:03:43 +0000 |
| Subject: | Re: Dynamic attributes from XSL (Sterling you might help) | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-116@lists.php.net to get a copy of this message | ||
On Sat, May 24, 2003 at 07:50:45PM +0300, Alexandru COSTIN wrote:
> <a>
> <xsl:attribute name="href">index.php?code=<xsl:value-of
> select="id"/></xsl:attribute>
> Link</a>
>
> We've heard that there might be a simpler way (using { or something).
This should do it:
<a href="index.php?code={id}">Link</a>
If you want to refer to an attribute instead of an element, use
something like this:
<a href="index.php?code={@id}">foo</a>
IIRC, you can use any XPATH expression inside those curly braces.
See W3C's XSLT spec for more. Okay, I know, W3C's documents are
unreadble, but once you get used to it you'll find a massive amount of
useful information.
Sander