Subject: [xsl] Re: xsl-list Digest 24 Sep 2004 05:10:00 -0000 Issue 187 From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 24 Sep 2004 13:35:47 +0100 |
None of the below call works: <xsl:template match="CUSTOMERS/*[name()=($ROOT)]"> <xsl:template match="($ROOT)"> <xsl:template match="name()"> A match pattern can't use a variable, and can't consist of top level use of () or the name function. You would just use a normal match template match="CUSTOMERS" for example would match CUSTOMERS. the point of the <xsl:apply-templates select="*[name()=$ROOT]"/> is to allow the parameter to affect the nodes to which templates are applied, you don't need to do anything special to define teh templates, that is the whole point of the exercise. In all your postings I don't think you've really stated what your real input is like, in the examples you have posted there has only been one element in the relevant position in the source file so really you would not need any parameter at all, you can just apply templates to whatever element is there (which is the default XSLT behaviour) given that you say you needed a parameter I'm assuming that your real input looks ike <x> <CUSTOMERS> ... </CUSTOMERS> <CLIENTS> ... </CLIENTS <SUPPLIERS> .. </SUPPLIERS> </x> and you want your parameter to choose between CUSTOMERS CLIENTS and SUPPLIERS in which case you would have templates matching those as normal and have <xsl:template match="x"> <xsl:apply-templates select="*[name()=$ROOT]"/> </xsl:template> so if $ROOT was "SUPPLIERS" then just SUPPLIERS would be processed and the other templates would never be activated. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] applying templates to all, Bruce D'Arcus | Thread | [xsl] Your Postings to XSL-List had, Mulberry Technologie |
Re: [xsl] value-of and param, Mukul Gandhi | Date | [xsl] RE: xsl-list Digest 24 Sep 20, Paria Heidari |
Month |