arnyinc
02-19-2003, 09:47 PM
I have a basic XML sheet setup for a contact list
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="simple.xsl" ?>
<contactlist>
<contact>
<firstname>joe</firstname>
<lastname>smith</lastname>
<email>joesmith@company.com</email>
<phone>555-555-5555</phone>
</contact>
<contact>
<firstname>bill</firstname>
<lastname>williams</lastname>
<email>billwilliams@company.com</email>
<phone>111-111-1111</phone>
</contact>
</contactlist>
Now I am trying to apply an XSL style sheet and I have a couple very basic questions. First, I cannot get a space to appear between the firstname and lastname. They are squished together when I view it. Second, the way I have the email link setup causes a massive error and makes it break. How would I integrate the email and name to just get something like <a href="mailto:billwilliams@company.com">Bill Williams</a>
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">
<body bgcolor="#cccccc">
<xsl:for-each select="contactlist/contact">
<div style="background-color:teal;color:white;padding:4px">
<a href="mailto:<xsl:value-of select="email"/>"><xsl:value-of select="firstname"/> <xsl:value-of select="lastname"/></a>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="phone"/>
</div>
</xsl:for-each>
</body>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="simple.xsl" ?>
<contactlist>
<contact>
<firstname>joe</firstname>
<lastname>smith</lastname>
<email>joesmith@company.com</email>
<phone>555-555-5555</phone>
</contact>
<contact>
<firstname>bill</firstname>
<lastname>williams</lastname>
<email>billwilliams@company.com</email>
<phone>111-111-1111</phone>
</contact>
</contactlist>
Now I am trying to apply an XSL style sheet and I have a couple very basic questions. First, I cannot get a space to appear between the firstname and lastname. They are squished together when I view it. Second, the way I have the email link setup causes a massive error and makes it break. How would I integrate the email and name to just get something like <a href="mailto:billwilliams@company.com">Bill Williams</a>
<?xml version="1.0" encoding="ISO-8859-1"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/TR/xhtml1/strict">
<body bgcolor="#cccccc">
<xsl:for-each select="contactlist/contact">
<div style="background-color:teal;color:white;padding:4px">
<a href="mailto:<xsl:value-of select="email"/>"><xsl:value-of select="firstname"/> <xsl:value-of select="lastname"/></a>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<xsl:value-of select="phone"/>
</div>
</xsl:for-each>
</body>
</html>