This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Transforming into embedded HTML


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@smith.com

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

<a href="mailto:john@smith.com";>john@smith.com</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@smith.com</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@smith.com 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]