help on EXLST function using Xalan

View: New views
4 Messages — Rating Filter:   Alert me  

help on EXLST function using Xalan

by naijacoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm required to write a xslt for a viewer that uses XALAN.This xslt will format a xsl to product HTML file.
After going to this site :http://xalan.apache.org/
i can't find any function i could use. This is my scenario below

My sample xml is below:
--------------------------
<report>
  <report_info>
    <header>
      <customer-delivery-4>3097</customer-delivery-4>
    </header>
    <subheader>
      <order-no>4802830</order-no>
      <order-date>09-09-09</order-date>
      <shipment-no></shipment-no>
      <customer-reference></customer-reference>
      <rep-name>Steven</rep-name>
    </subheader>
    <detail>
       <outright>
        <qty>111111</qty>
        <product>CJPOWERSD2GB    </product>
        <stock-description>Power SD2</stock-description>
        <stock-desc1>Aftermarket</stock-desc1>
        <stock-desc2>2GB</stock-desc2>
        <unit-price>16.95</unit-price>
        <discount>15.41</discount>
        <line-amt-ex-gst>0</line-amt-ex-gst>
        <line-gst-amt>0</line-gst-amt>
        <line-amt-inc-gst>0</line-amt-inc-gst>
        <item-cost>9</item-cost>
        <line-cost>9</line-cost>
        <gp>-9</gp>
      </outright>
      <plan>
        <plan-code>CWTM0049BUES33  </plan-code>
        <plan-desc>Cap Talk $49 24mth</plan-desc>
        <ban-text>Ban :</ban-text>
        <ban>12345678901                                       </ban>
        <prorata-monthly-text>Approx pro-rata charge is $  6.53                 </prorata-monthly-text>
        <prorata-call-text>Approx pro-rata included call credit $ 80.00      </prorata-call-text>
        <prorata-comment-1>Please refer to your sales consultant for an explanation of pro-rata (partial monthly) charges and call credit, or call </prorata-comment-1>
        <prorata-comment-2>Amount may differ from billed amount as a result of variation in billing cycle.</prorata-comment-2>
        <prorata-comment-3>Where applicable, this amount also includes Talk.</prorata-comment-3>
        <handset-code>NOKN86ST        </handset-code>
        <handset-desc>Nokia N86 3G Handset          </handset-desc>
        <handset-serial>NOKN860001          </handset-serial>
        <unit-price>   240.00</unit-price>
        <discount>     0.00</discount>
        <line-amt-ex-gst>   218.18</line-amt-ex-gst>
        <line-gst-amt>    21.82</line-gst-amt>
        <line-amt-inc-gst>   240.00</line-amt-inc-gst>
        <item-cost>   586.00</item-cost>
        <line-cost>   586.00</line-cost>
        <gp>   346.00-</gp>
        <bundles>
          <bundled-product>EXTENDWARR      </bundled-product>
          <bundled-desc>EWDIG2G - 1 Year Extended     </bundled-desc>
          <qty>1</qty>
          <line-amt-inc-gst>    29.00</line-amt-inc-gst>
          <unit-price>    29.00</unit-price>
          <discount>     0.00</discount>
          <line-amt-ex-gst>    26.36</line-amt-ex-gst>
          <line-gst-amt>     2.64</line-gst-amt>
          <line-amt-inc-gst>    29.00</line-amt-inc-gst>
          <item-cost>    18.18</item-cost>
          <line-cost>    18.18</line-cost>
          <gp>    10.82</gp>
          <plan-ew-imei>EW IMEI : NOKN860001          </plan-ew-imei>
          <plan-ew-mobile>EW Mobile No : 0407805552     </plan-ew-mobile>
          <plan-ew-expiry>EW Expiry Date : 09-SEP-2011  </plan-ew-expiry>
        </bundles>
        <multi-service>
          <multi-connect-type>Recontract</multi-connect-type>
          <multi-handset-code>NOHANDSET       </multi-handset-code>
          <multi-handset-desc>No Handset - Service Only GSM </multi-handset-desc>
          <multi-handset-serial></multi-handset-serial>
          <multi-mobile>000000000                    </multi-mobile>
          <line-amt-inc-gst>    17.95</line-amt-inc-gst>
        </multi-service>
      </plan>
    </detail>
    <total>
      <total-amount-inc-gst>   286.95</total-amount-inc-gst>
    </total>
    <footer>
      <text> warranty claims. </text>
    </footer>
  </report_info>
</report>

I want such an output:

Position 1 111111 CJPOWERSD2GB 16.95 15.41 0 0 0
Position 2 Power SD2
Position 3 Aftermarket
Position 4 2GB
Position 5 CWTM0029BUCL30
Position 6 Plan
Position 7 EXTENDWARR
Position 8 EWDIG2G

(As you can see Position 1,Position 2 ....)
I need to add a line number to each ROW as i need to do test for the linenumber and do a page break

Are there any functions in xalan i can use for this.I have done this in using micorsoft msxsl:node-set anyone availabe with xalan

Thanks a lot

Re: help on EXLST function using Xalan

by keshlam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What you're looking for is the xsl:number directive. Standard XSLT, not an EXSLT library function.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
 -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Re: help on EXLST function using Xalan

by naijacoder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Keshlam thanks for the reply.
I don't think xsl:number is what i need.
Please look at my xml very well.
What i want to achieve is a page break as this is an invoice and it will be printed.
I have tried using position() which is also a standard xslt but i can't use it because of the xml structure
thats why i need to EXSLT to so that i can write a script add a custom number to each row and then use that number to do a page break.
Hope have explained enough
Thanks

 

keshlam wrote:
What you're looking for is the xsl:number directive. Standard XSLT, not an
EXSLT library function.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish (
http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Re: help on EXLST function using Xalan

by David Bertoni :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

naijacoder wrote:

> Keshlam thanks for the reply.
> I don't think xsl:number is what i need.
> Please look at my xml very well.
> What i want to achieve is a page break as this is an invoice and it will be
> printed.
> I have tried using position() which is also a standard xslt but i can't use
> it because of the xml structure
> thats why i need to EXSLT to so that i can write a script add a custom
> number to each row and then use that number to do a page break.
> Hope have explained enough
The EXSLT node-set function is available in Xalan. You can use it just
as you would in any XSLT processor that supports EXSLT.

In the future, please ask questions like this on either the Xalan-C or
Xalan-J user list.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@...
For additional commands, e-mail: xalan-dev-help@...