Re: [xsl] Selecting and printing certain nodes

Subject: Re: [xsl] Selecting and printing certain nodes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 20 Feb 2004 17:06:52 GMT
> This prints out '$startDate' when I really want it to print the value of the
> xsl:param $startDate. Is there a way to do this in XSL?

No, you can't refer to the program variables from the source file unless
you have an extension element that makes an XPath parser available at
run time some systems do (saxon for example) but not all of them make
variable bindings available to the run time extension function.

ah I see you already are using dyn:evaluate so in that case you could
probably evaluate the string "$startDate" coming from the source.
But do you really want to polute your source files with the internal
variables used in the stylesheet. You wouldn't normally expect a file
read in to a compiled C program (say) to access the variables used in
that program, it's rather similar here.

Incidentally there is no need to have the if in

   <xsl:if test="@name"/>
        <xsl:value-of select="@name"/>

if the attribute isn't there it's value will be "".

  This all work great. Now my question is can you think of a way to handle
  nested foreach statments?

it'll just work automatically due to the nested apply-templates, won't
it? I can't see any reason why not.

  Do I need to pass a variable which is an array or something

XSLT doesn't have arrays, it  has node sets which are just as useful,
but I don't see that you have pass anything other than your existing 
item node.



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

Current Thread