Hi! XSQL/XSL Question How to do math? (Between 2 variables)

admin

Administrator
Staff member
Hi!


I have a XSQL page which gets several parameters in form an other page.. this is bit big (for me) / complex thing to explain fully but here the main points.

Where do I need this? A school assignment to be returned. It is supposed to be an airport web page, where you can book flights. IN this question I ask for help to calculate the REMAINING empty seats on a flight that a customer has selected.


I have an *.xsql page which does 4 different Queries to an Oracle database. Here 2 of those, which are concerned in this "dilemma/question":

<xsql:query rowset-element="RESERVATIONS" row-element="RESERVEDSEATS">
select count(TICKET.OUTBOUND) RESERVED
from TICKET
where TICKET.OUTBOUND='{@LENNONNRO}'
</xsql:query>

<xsql:query rowset-element="SEATS" row-element="PLANECAPACITY">
select CAPACITY
from AIRCRAFT
where SERIAL_NUMBER='{@LENTOKONENRO}'
</xsql:query>


On the base of the results I get the contents of those queries to a *.xsl page where I refer to each value like this:

<xsl:for-each select="//RESERVEDSEATS">
<xsl:variable name="TAKENSEATS">
<xsl:value-of select="RESERVED"/>
</xsl:variable>
</xsl:for-each>

<xsl:for-each select="//PLANECAPACITY">
<xsl:variable name="ALLSEATS">
<xsl:value-of select="CAPACITY"/>
</xsl:variable>
</xsl:for-each>

(THose up there work 100% and are ok, so no problem with them. Those variables do get a value (ALLSEATS and TAKENSEATS))

What I should do is to get the value of "RESERVED" diminished from the "CAPACITY" and to be able to print it out where ever I want on the *.XSL page :]

BUT HOW on earth can that Math be done? I have no clue, no material to find the info (this is a school task)
Like this: ?

Step 1. Create a variable that contains the EARLIER created variables beeing diminished from each other.

<xsl:variable name="FREESEATS">{$ALLSEATS}-{$TAKENSEATS}</xsl:variable><br/><br/>

Step 2. Print it out to be visible in a table cell (IF there is space left):

<td> Dear <xsl:value-of select="USERNAME"/> there are '{$FREESEATS}' on the flight you requested. </td>



One more dilemma. How do I print an variable (the value of a variable into text. Just with the good old <xsl:value-of select="variablename"/>?




Yes I tried PL-SQL earlier to do this with it, but see the problem was that I was not able to create a *.xsql method/ reference-cursor-function -sentence that had worked properly. :/

But please some one, help me with this one asp, cause I deffinately Am in a hurry....
 
Back
Top