xsl-list
[Top] [All Lists]

Re: How to call a template that can generate a file name from an element

2004-01-17 09:38:35
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[(_at_)name]"/>
 <!--    <xsl:value-of select="concat($outputDir,
$fileSep, $element[(_at_)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(_at_)nag(_dot_)co(_dot_)uk> wrote
 Since passing the element
 as a parameter and then using '$element[(_at_)name]' did
 not work 

If you passed an element as the parameter then 
$element[(_at_)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'[(_at_)name] is not valid Xpath.

----
Wendell Piez <wapiez(_at_)mulberrytech(_dot_)com> 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[(_at_)name] 
really gets you what you 
want, and not something else. $element[(_at_)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