Re: [PHP-XML-DEV] Dynamic attributes from XSL (Sterling you might help)
[email protected] (Sander Roobol)
| Newsgroups | php.xml.dev |
|---|---|
| Message-ID | <20030524170343.GA2548@lxr> |
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