Re: generate xsl 1.0 from 2.0 question
Hi Bryan, > anyway the thing I was wondering about is in the template > name="click_here" you'll notice I do the > $translator[@name='Click_here'] is there anyway to select the name > of the template one is in(in xslt 2.0), in such a way that I could > make a parameter holding the template/@name value and pass it to a > named template through a call? No, I don't think so (or at least no way that doesn't involve you using the name of the template in order to retrieve the name of the template). But I'm not sure what you think you'd gain by doing this anyway. Perhaps you have several templates that generate roughly the same thing, and you want to put that code in a separate template? If so, why not do that: <xsl:template name="createChoose"> <xsl:param name="translatorName" /> <temp:choose> <xsl:for-each select="$translator[@name = $translatorName] /(* | processing-instruction())"> <xsl:call-template name="translator" /> </xsl:for-each> </temp:choose> </xsl:template> [Note that I've swapped the child::node()[name() != ''] for something that explicitly selects the nodes that have names (i.e. elements and processing instructions) using XPath 2.0 general steps. I suspect that you're just after the elements, in which case you could just use $translator[@name = $translatorName]/*.] And have the createChoose template called by the various other named templates: <xsl:template name="click_here"> <xsl:call-template name="createChoose"> <xsl:with-param name="translatorName" select="'Click_here'" /> </xsl:call-template> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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