[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: calling template with name passed in a variable
Date: Fri, 18 Dec 2009 02:14:20 GMT From: David Carlisle <davidc@xxxxxxxxx> Subject: Re: calling template with name passed in a variable Message-Id: <200912180214.nBI2EKee001410@xxxxxxxxxxxxxxxxxxx>
it would be more natural to do
<xsl:template match="xsd:element[@type='MyTypeX']"> code for THIS type </xsl:template> .... <xsl:template match="xsd:element[@type='MyTypeY']"> code for THIS type </xsl:template> I would like be able to extend xsl easily by adding new types to InPlaceTypesList param and to add new templates handling these new types with templates' names being the same as the names of new types like this; <xsl:param name="InPlaceTypesList" select="('MyTypeX','MyTypeY','MyNewType1','MyNewType2')"/> <xsl:template name="MyNewType1"> code for THIS type </xsl:template> <xsl:template name="MyNewType2"> code for THIS type </xsl:template> To put this another way; I want to isolate adding templates (with purpose of handling new types) from code needed to invoke (match) them. Incidetally if that's the only use for InPlaceTypesList it is easier and more efficent to have a list of strings rather than elements. Ok.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|