W3C home > Mailing lists > Public > www-style@w3.org > March 2001

RE: Determining if an XSLT template has run

From: Jeffrey Yasskin <jyasskin@appcomp.com>
Date: Fri, 30 Mar 2001 08:00:45 -0600
Message-ID: <86BF1235655FD411BF4100C0F017B8A301F83D@SERVER1>
To: www-style@w3.org
Cc: Sampo Syreeni <decoy@iki.fi>, cagle@olywa.net
Another suggestion I received was: 
	<xsl:template match="/">
	        <xsl:when test="//row">
	                <!-- this outputs the regular page -->
	                <!-- this outputs a message saying nothing can be
output -->

I am using ASP to set the contents of the brackets, and I will eventually
move to client-side JavaScript DOM. I would prefer to only change one part
of the stylesheet in script, but both of these suggestions require that I
change two different attributes' values: the when-test or variable-select
and the template-match. This is possible but inconvenient. It breaks the
theory of storing information in exactly one place.
I could probably use an entity reference, but this seems inelegant.
A way to fire if an <xsl:for-each> never runs would also be perfectly

-----Original Message-----
From: Sampo Syreeni [mailto:decoy@iki.fi]
Sent: Friday, March 30, 2001 7:06 AM
To: Jeffrey Yasskin
Cc: www-style@w3.org
Subject: Re: Determining if an XSLT template has run

On Thu, 29 Mar 2001, Jeffrey Yasskin wrote:

>	<xsl:template match="/">
>		<h1>Header</h1>
>		<xsl:apply-templates />
>		<xsl:if test="$fired">
>		</xsl:if>
>	</xsl:template>
>	<xsl:template match="row[lots-of-conditions]">
>		<xsl:variable name="fired" select="true">
>		<p>Stuff</p>
>	</xsl:template>

Try <xsl:variable name="fired" select="//row[lotsa-conditions]/> (or
something faster with a more explicit path, or with keys) at the top level
instead. You just need to worry about variable scoping. No need for new
features in XSLT.

Sampo Syreeni <decoy@iki.fi>, aka decoy, student/math/Helsinki university
Received on Friday, 30 March 2001 09:04:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:57 UTC