[xsl] Transforming into embedded HTML

Subject: [xsl] Transforming into embedded HTML
From: "jmabbate" <jmabbate@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Jun 2002 23:36:39 -0400
I am trying to convert a web page that in essence is a directory
of members of a local association. A typical entry looks something
like this:

ABC Company          John Smith
                     123 Main Street
                     john@xxxxxxxxx

The last item, the email address, is presented as a link. In
other words, the actual html is

<a href="mailto:john@xxxxxxxxx";>john@xxxxxxxxx</a>

I created an XML version of the directory along these lines

<directory>
<member>
<company>ABC Company</company>
<contact>John Smith</contact>
<address>123 Main Street</address>
<email>john@xxxxxxxxx</email>
</member>
...
</directory>

To display this as HTML, I created an XSL file with a
<xsl:for-each select="directory/member"> loop. The trouble
I'm having is with the email. I basically need to include
john@xxxxxxxxx both as a value for the href attribute and
as plain text. As far as I can tell, the commands cannot
be nested like this

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

I tried escaping the angle brackets and quotes as follows:

  &lt;a href=&quot;mailto:<xsl:value-of
select="email"/>&quot;&gt;<xsl:value-of select="email"/>&lt;/a&gt;<br />

but the resulting html displays the <a href= ...> instead of a
link. I'm using a Javascript under MSIE 6.0 to test the
transformation.

It seems to me that this is not a unusual transformation but
I have looked in the XSL-List archives and XSL FAQ and couldn't
find anything on this topic.

Thanks in advance for any insights.

Joe



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread