Re: [xsl] Param Element

Subject: Re: [xsl] Param Element
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 3 Jun 2005 00:34:00 +0100
   It is working...

This seems unlikely.

   I'm still a little confused on the parm(s) but no worries!

   On 6/2/05, Karl Stubsjoen <kstubs@xxxxxxxxx> wrote:
   > Here is what I have, but not confident that it is working... it seems
   > that my check for uniqueness is failing, I get no results.  Isn't it a
   > fair test to ask of a value it it exists in a set of values as I am
   > here:
   >  <xsl:if test="$current_id = $activity_id">
   > Where activity_id is a set of ID values as defined below..
   > 
   > <xsl:param name="xm" select="in_proc" />
   > 
   > <xsl:variable name="activity_id" select="in_proc/row/@id"/>
   > 
   > <xsl:template match="/">
   >  <in_proc>
   >  <xsl:apply-templates select="row"/>
   >  <xsl:apply-templates select="$xm/row" mode="append"/>
   >  </in_proc>
   > </xsl:template>
   > 
   > <xsl:template match="row">
   >  <xsl:copy-of select="."/>
   > </xsl:template>
   > 
   > <xsl:template match="row" mode="append">
   >  <xsl:variable name="current_id" select="@id"/>
   >  <xsl:if test="$current_id = $activity_id">
   >    <xsl:copy-of select="."/>
   >  </xsl:if>
   > </xsl:template>
   > 
   > </xsl:stylesheet>
   > 
   > 


 <xsl:apply-templates select="row"/>
 <xsl:template match="row">
  <xsl:copy-of select="."/>
 </xsl:template>
 
is equivalent (but slower, probably) to
<xsl:copy-of select="row"/>
it just copies all the row elements. In this case however it prduces
nothing as there are no row element children of the current node (the
only child of / is a in_proc element (I guess, you have not shown your
input format)

 <xsl:if test="$current_id = $activity_id">
this test is always true (given the default value of $xm) as $current_id
is an attribute node from the set $activity_id
Even if you supply an xm parameter so that the tests may be false, 

 <xsl:apply-templates select="$xm/row" mode="append"/>
 <xsl:template match="row" mode="append">
  <xsl:variable name="current_id" select="@id"/>
  <xsl:if test="$current_id = $activity_id">
    <xsl:copy-of select="."/>
  </xsl:if>
 </xsl:template>

is equivalent to

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

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