Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xsl totals composed from variables

From: "the_jos" <the_josb@-----.--->
To: NULL
Date: 11/5/2006 3:36:00 PM


Joe Kesselman wrote:
> Dimitre Novatchev wrote:
>
> For example: Show us what output you're trying to get, and explain
> specifically how that output was obtained.
>
> Or, if you want to figure this out yourself: Put some output (either
> document output, or xsl:message calls) into your loop template,
> displaying the values of your variables. The first thing you'll discover
> is that because you failed to explicitly pass $pr into the recursion, it
> isn't set the second time through, so your "loop" isn't doing much looping.

Joe,

Thanks for the reply.
I'll look into your example and your surgestion above tomorrow (it's
getting late here in Europe).

I'm trying to get a better understanding about xml/xsl and am trying to
do that with something that interests me. So I am trying to build a xml
document that determines the minimum net. value of some components in
an online game.
I can do this in a program language (like java), but am looking for a
more code-independent solution. I then found out that xml/xsl does not
handle variables the way a program language does. But that's not
entirely strange, given the nature of xsl.

Let's give a somewhat real-life example:

Lets say I want a table set.

I know the components are:
4 chairs and one table.
A chair is 4 legs and one chair_top.
A table is 4 legs and one table_top.
A table_top is 2 hours of work and 2 wood. Or 100 euro's
A chair_top is 1 hour of work and 1 wood. Or 50 euro's.
Legs are 1 hour of work and 1 wood. Or 25 euro's.

Wood is 5 euro's, work is 20 euro's.
Prices vary, but components remain the same.

For my question, I just wanted to determine the value of legs (25),
chair_top (25) and table_top (50) given the price of wood and work.

I figured out that when I have those values, I can determine the
minimum value of those components.
Given that, I can determine the minimum value of chair and table and
with those the minimum value of 'table_set'.
There willl be various combinations for table_set (like 6 chairs/one
table, 4 chairs /2 tables).
So I figured to make 2 xml sets.
One for each final table_set. This one contains the set name and the
number of tables/chairs.
And one for the base components (in this case wood and work) and the
various combined components (like the legs and tops and ultimate
tables/chairs).

The table_set will inherent / import the data from the list of
base/combined components, which are 'processed' so they will only give
the minimum values.
So when I look up 'table', it calculates building legs and table_top,
determines if building or buying is cheaper, calculate the minimum
value for table based on those results and returns that value.

This would lead to a layout like:
Table_set 1: Tables=1 Chairs=4 Price=650 (150+500)
Table_set 2: Tables=2 Chairs=6 Price=900 (150+750)

Now that I'm thinking about it, is it best to handle the 'combined'
components in the xsl file (put price in xml file and the 'combining
logic' in xsl). Or should I just leave it the way it is right now?

I think I will be working on this idea for the next weeks, but that's
part of learning something new.
It won't be a big xml set for the base components.
I think there's 20 base materials (like wood and work) and 15 combined
(like legs/tops).
The 'table' and 'chair' components are rare, I think there are about 4.
So I figured handling this with xsl should not cause too much resource
problems.



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent