cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Blake <p...@tcp.net.au>
Subject Conditionally adding anchors
Date Thu, 31 Jan 2002 04:59:54 GMT
Hi again,

I solved the previous problem - the code to make it work is in this post.

A quickie, I hope :)

The following XSL generates the error:
org.apache.cocoon.ProcessingException: Error in creating Transform 
Handler: org.xml.sax.SAXParseException: The element type "a" must be 
terminated by the matching end-tag "</a>".

I am wanting to conditionally make an anchor around some other elements 
(an icon and text) and tried the following. It didn't work for obvious 
reasons. What is the best practice to achieving this.

<!-- Is this an anchor? open it -->
<xsl:if test="url">
	<a href="{url}">
</xsl:if>
<!-- Add any icon -->
<xsl:if test="icon">
	<img border="0" src="images/icons/{icon}"/>
</xsl:if>
<span class="listlabel">
	<xsl:variable name="selectorValue" select="selector"/>
	<xsl:variable name="displayValue" 
select="$currentElement/*[name()=$selectorValue]"/>
	<xsl:value-of select="$displayValue"/>
</span>
<!-- Is this an anchor? close it -->
<xsl:if test="url">
	</a>
</xsl:if>

Thanks for your time,

Phil


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message