RE: [xsl] for-each tokenize() and context problem

Subject: RE: [xsl] for-each tokenize() and context problem
From: "Mario Madunic" <Mario_Madunic@xxxxxxxxxxxx>
Date: Thu, 19 Nov 2009 12:18:26 -0600
Thanks Martin, it worked like a charm.

For clarification,

Any for-each that is a descendant of a for-each (with no parent for-each) will
lose its context. The context will be the current node, in this case text. Am
I correct in this assumption?

Would the same be true of if I for-each'd an element with child nodes and then
for-each'd the child nodes (it contains child nodes). I'm assuming that the
child for-each will only have context to descendants and not ancestors.
Hopefully that made sense.

Thanks again Martin for the quick and helpful reply.

Marijan (Mario) Madunic
Publishing Specialist
New Flyer Industries

-----Original Message-----
From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Sent: Thursday, November 19, 2009 11:33 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] for-each tokenize() and context problem

Mario Madunic wrote:
> I have the following variable,

Put an
   <xsl:variable name="t" select="."/>
here, then

> <xsl:variable name="l_GetPartNumber">
>   <xsl:for-each select="tokenize(normalize-space($l_Components), ' ')">
>     <xsl:variable name="l_Num" select="." />
>     <xsl:for-each select="ancestor::*[self::page]/row[entry[1] =
$l_Num]/entry[3]">

here use
       <xsl:for-each select="$t/ancestor::*[self::page]/row[entry[1] =
$l_Num]/entry[3]">

That is necessary as with the for-each select="tokenize(...)" you no
longer have the context node you have outside of the for-each.




--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/


--------------------------------------------------------------------
Please consider the environment before printing this e-mail.

CONFIDENTIALITY STATEMENT: This communication (and  any and all information or
material transmitted with this communication) is confidential, may be
privileged and is intended only for the use of the intended recipient. If you
are not the intended recipient, any review, retransmission, circulation,
distribution, reproduction, conversion to hard copy, copying or other use of
this communication, information or material is strictly prohibited and may be
illegal. If you received this communication in error or if it is forwarded to
you without the express authorization of New Flyer, please notify us
immediately by telephone or by return email and permanently delete the
communication, information and material from any computer, disk drive,
diskette or other storage device or media. Thank you.

Current Thread