Re: [xsl] Param Element

Subject: Re: [xsl] Param Element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 2 Jun 2005 21:25:35 +0100
> One other dilemna:  in order for the transformation to not complain, I
> have to do a select on my parameter declerations which looks like:

> <xsl:param name="xm" select="/" />

If you pass in a value of this parameter then the select here is not
used, it is just a default value in case no parameter is supplied when
the stylesheet is called.



> But since the source is the exact same as the parameter xml, how does
> the select know which source to grab from? 

The select is always explictly into a specified node set that node set
will have nodes from one or more documents (usually just one).
in this case, you have select="/" so that selects the root node ancestor
of the current node. If this is at the top level of teh stylesheet the
current node is the root node of the main input document, so / selects
that node.

> Also, the above causes an
> overflow when the below transformation is processed,

most likely you have programmed an infinite loop, but it's hard to say
given the snippet you showed.


> so would it be correct to express select as:  select="in_proc"?
That's also correct (but dofferent of course) but still if you supply a
value to this parameter when you run the program it doesn't matter what
select expression you use here.

The templates that you show make no use of this parameter??

As written you will get a copy of the input doc except the top level
element will be duplicated as you generate an in_proc element in the
template for / and then apply templates to the child nodees (which is
the in_proc element in the source) which are copied.


David

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

Current Thread