|
Subject: Re: [xsl] Stumped: XSL 1.0 recursive template From: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx> Date: Wed, 17 Nov 2010 10:23:35 -0500 |
On Wed, Nov 17, 2010 at 9:31 AM, daniel whitney <dbf.whitney@xxxxxxxxx> wrote:
> Thanks for the response Brandon. But I'm still having problems
> understanding what's happening here. With the example I provided the
> attribute values I am comparing are:
> 60, 60.09, 60.09, 60.09, 80.
>
> The comparisons being returned are:
> False, True, True, True. It's the last test evaluating to True that
> confuses me. Why when I'm on the last desc value of 60.09 and the
> following-sibling value is 80 (which is the last RECORDSECTION in the
> transform) does it evaluate to TRUE? As a test I changed all the desc
> values so that they were unique. I ran the transform and every test
> came back True except for the first one.
There is an additional wrinkle in your original code that I didn't
catch the first time through, but which you essentially caught when
you added the "[1]" to the expression for fincodeParam on the
recursive call. Using a notation of "@60" for an attribute node with
value "60" and "RS[60]" for a RECORDSECTION element node with a "desc"
attribute with a value of "60", the calls to financialTemp look like
this:
fincodeParam=@60 nextRecordParam=(RS[60.09], RS[60.09], RS[60.09], RS[80])
fincodeParam=(@60.09, @60.09, @60.09, @80)
nextRecordParam=(RS[60.09], RS[60.09], RS[80])
fincodeParam=(@60.09, @60.09, @80)
nextRecordParam=(RS[60.09], RS[80])
fincodeParam=(@60.09, @80) nextRecordParam=(RS[80])
fincodeParam=@80 nextRecordParam=()
The last call is a no-op that terminates the recursion. The first
call gives the "false" response, since the "60" value in fincodeParam
doesn't match any of the @desc values in nextRecordParam. The next
three all return true if for no other reason than there are "80"
values in both parameters. By adding the "[1]" into the test, you
only compare with the first @desc value in nextRecordParam. By
putting "[1]" into the expression for fincodeParam on the recursive
call, the calls look like this:
fincodeParam=@60 nextRecordParam=(RS[60.09], RS[60.09], RS[60.09], RS[80])
fincodeParam=@xxxxx nextRecordParam=(RS[60.09], RS[60.09], RS[80])
fincodeParam=@xxxxx nextRecordParam=(RS[60.09], RS[80])
fincodeParam=@xxxxx nextRecordParam=(RS[80])
fincodeParam=@80 nextRecordParam=()
Hope that clears up what was happening.
-Brandon :)
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Stumped: XSL 1.0 recursiv, daniel whitney | Thread | [xsl] XSLT Optimizer and Deployment, Karl Stubsjoen |
| Re: [xsl] Stumped: XSL 1.0 recursiv, daniel whitney | Date | [xsl] xsl: variable comparision, ram |
| Month |