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

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top