Hi all,
I just figured this out... when the "xsl:param" command is executed, the context item is whatever it was before the <xsl:iterate> command occurred. I assumed the context item was already the first item being processed.

-David

On Thu, Sep 6, 2012 at 7:56 PM, David Rudel <fwqhgads@gmail.com> wrote:
Hi all,

In one of my scripts, a parameter inside xsl:iterate is not being set to its initial value.

The segment of the script in question is shown below:

<xsl:iterate select="descendant::item">
                        <xsl:param name="previousfacts" select="../preceding-sibling::element()[item]/descendant::item[@type='fact']/@id" as="xs:string*"/>
                        <debug readout1="{count($previousfacts)}"
                            readout2="{$previousfacts}"
                            readout3="{../preceding-sibling::element()[item]/descendant::item[@type='fact']/@id}"
                        />
</xsl:iterate>

When I run this script I get the following output for the first item processed:

<debug readout1="0" readout2="" readout3="15 30 171 42 14 30 3 199 222 71 172 199 79 71 42 300 199 11"/>

It seems that "previousfacts" is being initialized as an empty sequence even though the Xpath expression inside its select attribute provides a sequence of 18 items.
I've tried omitting the "as" attribute, and I've also tried creating a sequence constructor and also tried using "for $i in ../preceding-sibling::element()[item]/descendant::item[@type='fact'] return $i/@id"  None of them manage to cause the sequence to initialize as anything other than the empty sequence.

I realize I'm not sending the whole script or the source file, etc., but I'm hoping the above is enough for someone to figure out what I'm doing wrong.

-David


--

"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.



--

"A false conclusion, once arrived at and widely accepted is not dislodged easily, and the less it is understood, the more tenaciously it is held." - Cantor's Law of Preservation of Ignorance.