Re: [xsl] Param Element

Subject: Re: [xsl] Param Element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 3 Jun 2005 10:00:03 +0100
  How do you select the root element of a parm and guarantee that it is
  not the root element of the source

If the current node is in your source and a parameter x contains a root
nodeof another document then

select="/" selects the root node of the source.
select="$x" selects the root node of the other document
select="$x|/" selects both nodes.

In your case though, unless you are passing in anohter document as an
external parameterm your parameter and your input document are the same
node (not just equal values, but actually teh same thing) so in this
case


select="/" select="$x"select="$x|/" all just select a single node, the
root node of your input.

> This is working properly, where activity_id is a RTF of existing
> activity id's. 

In the code that you posted, activity_id, was a node set not a result
tree fragment, and the test would always be true. 
 <xsl:apply-templates select="row"/>
produces no output and
<xsl:apply-templates select="$xm/row" mode="append"/>
produces a copy of the input, as the test is always true, so nothing is
filtered.

It is always true if $xm has its default value as $current_id =
$activity_id is true if the string value of $current_id is equal to the
string value of one of the nodes in the node set $activity_id.  But you
know in advance that the node $current_id is in the node set
$activity_id so clearly its string value is equal to itself, so the test
is true. If the xm parameter is a different document to the source
document then it is not necessaril always true as then  $current_id
is a node in the xm parameter and  $activity_id is a set of nodes in the
main document, but as I said, in that case your construction is
equivalent to


<xsl:copy-of select="$xm/row[@id = $activity_id]"/>

ie copy all rows from xm that have an id equal to a row in the main
document.

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