RE: [xsl] Output a link in a transformation to html

Subject: RE: [xsl] Output a link in a transformation to html
From: Nate Austin <naustin@xxxxxxxxxx>
Date: Thu, 31 May 2001 18:07:58 -0500
Luare-

XSLT needs to be well-formed XML.  I'd suggest doing some reading on exactly
what that means.  http://www.w3.org/XML/ should provide you with a few links
for starters.  The reason that is not well-formed is because <xsl:value-of/>
is an element.  Since HREF is an attribute, it cannot have complex (element)
content.  It also must enclose its content in " or '.  The solution to your
problem would look something like this:
    <h3>Web: <a><xsl:attribute name="href" select="."/><xsl:value-of
select="."/></a></h3>

or (using an Attribute Value Template):

    <h3>Web: <a href="{.}"><xsl:value-of select="."/></a></h3>

Hope that helps,
Nate
naustin@xxxxxxxxxx

>Date: Wed, 31 May 2000 21:37:07 +0200
>From: "Luare" <luare@xxxxxxxxxx>
>Subject: [xsl] Output a link in a transformation to html
>
>    Hi,
>
>I am doing a transformation from xml to html.
>This example is not well-formed, why?
>
>    <H3>Web: <A HREF= <xsl:value-of select="."/>> <xsl:value-of
select="."/>
></A></H3>
>
>The expresion <xsl:value-of select="."/> return a string, doesn't it?
>
>If I put    "<xsl:value-of select="."/>"
>or     string(<xsl:value-of select="."/>)
>the error is the same.
>
>It seem a tipical error, but I am a beginner.
>
>Thanks

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


Current Thread