href values and value-of

D

Dante

Hello. I am creating an xml list of links with structure like the
below:

<item>
<title>Bullet Madness</title>
<uri>http://www.stylegala.com/archive/bulletmadness/</uri>
<description>200 bullets, each of them nice in their own
way</description>
</item>

I need to create a link with that data. When I tried to do something
like
<a href="<xsl:value-of select="uri">">text</a>

I got the error that the structure was not well formed. How else would
I create a link with proper structure?

Thanks, Dante
 
C

Chris Huebsch

Dante (29 Sep 2004 20:46:59 -0700):
<item>
<title>Bullet Madness</title>
<uri>http://www.stylegala.com/archive/bulletmadness/</uri>
<description>200 bullets, each of them nice in their own
way</description>
</item>

I need to create a link with that data. When I tried to do something
like
<a href="<xsl:value-of select="uri">">text</a>

<a>
<xsl:attribute><xsl:value-of select="uri"/></xsl:attribute>
text
</a>

Chris
 
M

Malcolm Dew-Jones

Dante ([email protected]) wrote:
: Hello. I am creating an xml list of links with structure like the
: below:

: <item>
: <title>Bullet Madness</title>
: <uri>http://www.stylegala.com/archive/bulletmadness/</uri>
: <description>200 bullets, each of them nice in their own
: way</description>
: </item>

: I need to create a link with that data. When I tried to do something
: like
: <a href="<xsl:value-of select="uri">">text</a>

: I got the error that the structure was not well formed. How else would
: I create a link with proper structure?


Something like

&lt;a href="<xsl:value-of select="uri">"&gt; text &lt;/a&gt;
 
R

Richard Tobin

<a href="<xsl:value-of select="uri">">text</a>
[/QUOTE]
<a>
<xsl:attribute><xsl:value-of select="uri"/></xsl:attribute>
text
</a>

You forgot the attribute name:

<xsl:attribute name="href"><xsl:value-of select="uri"/></xsl:attribute>

There's a shorthand for attribute values:

<a href="{uri}">text</a>

See "attribute-value-templates" in the XSLT spec.

-- Richard
 
D

Dante

Chris Huebsch said:
<a>
<xsl:attribute><xsl:value-of select="uri"/></xsl:attribute>
text
</a>

Chris


Wouldn't you have to specify the attribute, by doing
<xsl:attribute="href"><xsl:value-of select="uri"/></xsl:attribute>
?

Dante
 
C

Chris Huebsch

Dante (30 Sep 2004 08:59:31 -0700):
Wouldn't you have to specify the attribute, by doing
<xsl:attribute="href"><xsl:value-of select="uri"/></xsl:attribute>
?

as others stated already

<xsl:attribute name="href">....


Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top