Subject: [xsl] Re: How to call a template that can generate a file name from an element From: Ian Lang <ianplang@xxxxxxxxx> Date: Sat, 17 Jan 2004 08:38:35 -0800 (PST) |
Thanks for the help so far. I still do not see what is causing my problem. In the full example I origonally sent the the template looks like this (actual file name generation commented out until I can get just the name to work): <xsl:template name="createBaseFrameFileName"> <xsl:param name="element"/> <xsl:value-of select="$element[@name]"/> <!-- <xsl:value-of select="concat($outputDir, $fileSep, $element[@name], '_index', '.html')"/> --> </xsl:template> and it gets used to create a variable like this: <xsl:variable name="generatedName"> <xsl:call-template name="createBaseFrameFileName"> <xsl:with-param name="element" select="."/> </xsl:call-template> </xsl:variable> I like the idea of using a default for the param element to use the context node - thanks. But it still does not want to pass the context element as a parameter for some reason. My select looks like your example and my XPath expression to get the name looks good. I must be missing something! Thanks, Ian ----- David Carlisle <davidc@xxxxxxxxx> wrote > Since passing the element > as a parameter and then using '$element[@name]' did > not work > > If you passed an element as the parameter then > $element[@name] would > work. If it didn't work then presumably you did not > do that, perhaps you > passed a string with an element name > instead? 'foo'[@name] is not valid Xpath. ---- Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote At 12:29 PM 1/14/2004, you wrote: > It will work: we do this all the time. Sometimes > it's even recommended to > do this even when you don't have to, instead of > relying on context > implicitly (it's more versatile and clearer for > maintenance). > > As I said earlier, check whether $element[@name] > really gets you what you > want, and not something else. $element[@name] is not > the same as $element/@name. :-> __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Re: How to call a templat, Wendell Piez | Thread | [xsl] Re: How to call a template th, Ian Lang |
Re: [xsl] Passing a Parameter to XS, M. David Peterson | Date | [xsl] Re: How to call a template th, Ian Lang |
Month |