RE: Making dynamic href's in XSL

Subject: RE: Making dynamic href's in XSL
From: "Mabry, F. DR EECS" <df6954@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 May 2000 18:08:07 -0400
The XML you included is not valid.  Remember XSL is XML.  To construct the
href _attribute_ of the a [anchor] _element_ in an XHTML document, you
should probably do something like the following:

<xsl:if test="num_active_tasks > 0">
<a>

<xsl:attribute 
 name="href"><xsl:text>show_tasks.jsp?pcode=</xsl:text><xsl:value-of
select="site_code"/><xsl:text>&#0026;project_number=</xsl:text><xsl:value-of
select="number" /></xsl:attribute>

<xsl:value-of select="number" />
</a>

</xsl:if>


I don't recall what the character is that is referenced by &#0026;.  If you
are intending that character to be in "http transfer markup" then you
probably have a little more to do.  The point is that the attribute portion
of the "a" element that you want to generate has its value set in the xsl
attribute statement.  The link's text string MUST be indicated after the
attribute is complete because it is the "value" of the "a" element.

Frank
Dr. Frank Mabry
Dept. of EE&CS, U.S. Military Academy
West Point, NY 10996
email: df6954@xxxxxxxxxxxxxxxxxxx
Phone: (914) 938-2960


Making dynamic href's in XSL
From: "Brian Burridge" <brian_burridge@xxxxxxxxxxxxx
<mailto:brian_burridge@xxxxxxxxxxxxx> >
Date: Wed, 31 May 2000 17:18:57 -0400
I'm trying to build a dynamic href like this:
<xsl:if test="num_active_tasks>0"><a
href="show_tasks.jsp?pcode=<xsl:value-of select="site_code"
/>&#0026;project_number=<xsl:value-of select="number" />"><xsl:value-of
select="number" /></a>

but I get the error "The value of attribute "href" must not contain the
'<' character. ". I understand what the error means, but I'm not sure
how to get around it. Is there a better way of building a dynamic href?

--

Brian N. Burridge
Internet Architect
Ext 3515
The Internet Group - ITSS
Cox Target Media





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


Current Thread