Creating links using XSLT

C

carlosramirez

I'm just starting with XSLT and I'm having problems generating links.
Here's a snippet of my xml file:

users.xml

<users>
<user>
<name>User1</name>
<email>[email protected]</email>
</user>
....
</users>

My XSL file is as follows:

<xsl:for-each select="users/user">
<a href="<xsl:value-of select="email" />"><xsl:value-of
select="email"/></a>
</xsl:for-each>

I keep getting the error "XML Parsing Error: not well-formed" at the
line number that contains the email.

My question, how can I generate the following string: <a
href="mailto:$email">$email</a>

Thanks.

-Carlos
 
S

Stephane Roux (HAbeTT)

<users>
<user>
<name>User1</name>
<email>[email protected]</email>
</user>
...
</users>

My XSL file is as follows:

<xsl:for-each select="users/user">
<a href="<xsl:value-of select="email" />"><xsl:value-of
select="email"/></a>

<a href="mailto:{email}"><xsl:value-of> select="email" /></a>
 
S

Stephane Roux (HAbeTT)

Stephane Roux (HAbeTT) said:
<a href="mailto:{email}"><xsl:value-of> select="email" /></a>

<a href="mailto:{email}"><xsl:value-of select="email" /></a>
 
J

JAPISoft

Try this :

<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="email" />
</xsl:attribute>
</xsl:element>

Best regards,

A.Brillant
EditiX - XML Editor and XSLT Debugger
http://www.editix.com
 

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

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top