xsl-list
[Top] [All Lists]

Re: [xsl] calling template with name passed in a variable

2009-12-18 16:33:43
2009/12/17 Piotr Dobrogost 
<pd(_at_)2009(_dot_)xsl-list(_dot_)dobrogost(_dot_)pl>:
Hi

Can I call a template passing its name dynamically (by means of select or
variable)?

Have a look at FXSL, but bear in mind that all the good people
(telling you may not actually need this) could be right.


Also, in XSLT 2.1 / XPath 2.1 higher-order functions become official.



-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
I enjoy the massacre of ads. This sentence will slaughter ads without
a messy bloodbath.




I'd like to do something like this

<xsl:template name="MyTypeX">
 (...)
</xsl:template>

<xsl:template name="MyTypeY">
 (...)
</xsl:template>

<xsl:param name="InPlaceTypesList" as="element()*">
 <type>MyTypeX</type>
 <type>MyTypeY</type>
</xsl:param>

<xsl:template match="xsd:element[(_at_)type=$InPlaceTypesList]">
 <xsl:call-template name="@type"/> // <-- error line
</xsl:template>

Error at xsl:call-template on line 135 column 38 of xsd2perl.xsl:
 XTSE0020: Invalid QName {(_at_)type}


Regards
Piotr Dobrogost

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--