[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Transforming into embedded HTML


Subject: RE: [xsl] Transforming into embedded HTML
From: "Max Dunn" <maxdunn@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 Jun 2002 20:52:28 -0700

This is the reason that God created Attribute Value Templates...

for example
http://www.ibiblio.org/xml/slides/xmloneaustin2001/xslt/21.html

Max

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of jmabbate
Sent: Thursday, June 06, 2002 8:37 PM
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] 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@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





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



Current Thread
Keywords