lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] calculation summary, questions about xslt


From: Evgeniy Tarassov
Subject: Re: [lmi] calculation summary, questions about xslt
Date: Thu, 12 Oct 2006 13:44:56 +0200

On 10/10/06, Greg Chicares <address@hidden> wrote:
On 2006-10-10 0:23 UTC, Evgeniy Tarassov wrote:
>
> 2) html.xsl
>
> 2.1 the code generating html contains an expression
>
> (is_subject_to_ill_reg(ledger_values.GetLedgerType()))
>
> Do you think that (in xslt) we could express it using values already
> exported into xml. Or should we export additional named value?
> (another double_scalar value maybe?)

Is this a unique situation? If there's only one value like this
(or only a few), then I'd agree: it's best to export an additional
value to xslt.

It is the only place in html.xsl that needs some additional
information from illustration xml data. What do you think could be the
best name for that value? Maybe something like:

<double_scalar name="SubjectToIllReg">1</double_scalar>
with its value taking 1 or 0 and numeric-formatting rule 'F1' applied.

When we were doing everything in C++, it was sensible enough to
segregate this logic into one function (which is used in the input
code as well). We can just call that function when we create data
to pass to xslt.

> 3) schema.xsd
>
> 3.1 do we want to separate string_ nodes from double_ nodes?
> (string_vector and double_vector)

stronger validation) and doesn't make your work harder. As long as
I've portrayed your viewpoint correctly and you still think it's a
good idea, then my answer is "Yes", you've persuaded me.

Thank you for the confirmation!

> 4) tab_delimited.xsl
> 4.1 the code generating CSV formatted data contains some code checking
> that e_run_curr_basis_sa_zero is present in
> ledger_values.GetRunBases().
>
>        std::vector<e_run_basis> const& bases(ledger_values.GetRunBases());
>        if
>            (   bases.end()
>            !=  std::find(bases.begin(), bases.end(),
> e_run_curr_basis_sa_zero)
>            )
>            {
>
> Do you think there is already some way to check that using the already
> exported values?

First of all, this is similar to
> 1) illustration_reg.xsl
above in that it's not part of the calculation summary, so it's not
a top priority. But it's different in that PrintFormTabDelimited(),
the function you're quoting here, really is the production version,
so you do have enough information to replace it. And, while it is a
lower priority than the calculation summary itself, it's extremely
valuable to replace it--and it makes a lot of sense to do it now,
because it's so similar to the calculation-summary work.

This seems somewhat similar to is_subject_to_ill_reg() as discussed
above. When it's all done in C++, all this data is available in the
'ledger' class, so there's no strong reason not to use it. But now
we need to take a fresh look. What's the best way to do this with
xslt?

If the only purpose of that if statement is to keep code from calling some
non-existing value, then in xslt we could probably completly remove
that. In xslt we can check if a particular value (in pur case
@name='NetCOICharge', @basis='run_curr_basis_sa_zero') is present and
then output its value, or place a '0', if the value is not present.

        if
            (   bases.end()
            !=  std::find(bases.begin(), bases.end(), e_run_curr_basis_sa_half)
            )
            {
            fatal_error()

This is really just an assertion. It seems appropriate to keep
that code, and run it whenever data is prepared for transmission
to xslt.

This assertion is present in PrintFormTabDelimited but not in
Ledger::write code. Does it mean that for that type of ledger we
simply can not produce tab delimited text, or does it mean that entire
calculation summary does not make sense for that type of ledger?

        // Show experience-rating columns for current-expense, zero-
        // interest basis if used, to support testing.
        std::vector<e_run_basis> const& bases(ledger_values.GetRunBases());
        if
            (   bases.end()
            !=  std::find(bases.begin(), bases.end(), e_run_curr_basis_sa_zero)
            )
            {/* print the actual data */}
        else
            {/* print zeros */}

Here, what's important is whether 'e_run_curr_basis_sa_zero' data
exists; if it didn't, there'd be a segfault. I understand C++ better
than I understand xslt, so I don't know how this would naturally be
handled in xslt; probably I'd better ask your advice.

If the data for that "basis" fails to exist, we really do want to
print zeros. The goal is to use exactly the same column layout in

Thank you for your explanation!
Now if i understand it correctly we could rely on the presence of the
value in the produced ledger data XML, since the values "protected" by
the 'if' expression in PrintFormTabDelimited function will exist only
when e_run_curr_basis_sa_zero is in ledger_values.GetRunBases(), and
will _not_ be exported if e_run_curr_basis_sa_zero is _not_ in
ledger_values.GetRunBases(). And we dont need to export any additional
value into XML.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]