Linking with xml content

S

Sneamia

Hi, im a noob at xml and stuff.
I have an xml document, and I styled it with an xsl file.
I want to use content in the xml file to use as a link, like, for
example, in the xml file is this:

<link>http://www.link.com</link>
<description>A link</description>

I want to use something like:

<xsl:for-each select="file/content">
<td><xsl:value-of select="description"/></td>
</xsl:for-each>

Is there any simple way for me to use the data for the link in the xml
file to link the description?
like <a href="<xsl:value-of select="link"/>"><xsl:value-of
select="description"/></a>, but it doesnt work because I cant have a
tag in a tag...is there something I'm missing?
 
J

Joe Kesselman

like said:
select="description"/></a>, but it doesnt work because I cant have a
tag in a tag...is there something I'm missing?

1) Attribute Value Templates
<a href="{link}"><xsl:value-of select="description"/></a>

2) xsl:attribute
<a>
<xsl:attribute name="href">
<xsl:value-of select="link"/>
</xsl:attribute>
<xsl:value-of select="description"/>
</a>
 

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
474,002
Messages
2,570,258
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top