RE: [xsl] apply two different templates at the same time

Subject: RE: [xsl] apply two different templates at the same time
From: ben <ben@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 31 Jan 2002 10:37:47 -0000
You could try calling a named template from each existing template. The
named template will change the background colour.

You would need one template for each element
<xsl:template match="...">
	... Do existing stuff ...

	<xsl:if test="[@mark]">
		<xsl:call-template name="marker" />
	</xsl:if>

</xsl:template>

And a generic marker template called when needed
<xsl:template name="marker">
	... Set background colour ...	
</xsl:template>

Hope that helps

Cheers,
Ben

-----Original Message-----
From: Andrew Welch [mailto:andrew@xxxxxxxxxxxxxxxxxxxxxxx]
Sent: 31 January 2002 09:44
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] apply two different templates at the same time


Hi,

I know the answer to this is probably no, but someone may have a work
around....

I have a load of data and a load of templates, and it all gets displayed
nicely.  If any of the elements in the data contain an attribute 'mark="1"'
then the data should be highlighted by changing its background colour.  The
mark attribute can apply to any element in the data.

Currently, I use two templates for each element - one matching just the
element and one matching the element with the 'mark' attribute...

...is it possibly to cut down on the duplication of code?

The stylesheet is applied using an embedded link (requirement) - does this
prevent a double-pass?

andrew

===


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


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

===========================================================
Pulse Software Systems Limited.
Pulse House, 5 & 7 Gravel Hill, Leatherhead, Surrey. KT22 7HG
Tel: (01372) 220600 Fax: (01372) 362476
Web: http://www.pulsesoftware.co.uk

This e-mail (and any attachments) may contain confidential or privileged information. If you are not the intended recipient 
or you receive this message in error please notify us immediately and delete the e-mail. Should this be the case then you are notified that any dissemination, distribution, or copying of this communication and its attachments is strictly prohibited.

This message has been checked for all known viruses by the 
Message Labs Virus Scanning Service. For further information visit 
http://www.messagelabs.com/stats.asp

Neither Pulse Software Systems nor the sender accepts any liability or 
responsibility for viruses or for any damage you may sustain. You should perform your own virus checks before opening any attachments. 
===========================================================

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


Current Thread