[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using variables in extension elements

Subject: Re: Using variables in extension elements
From: Roger I Martin PhD <hypernexdev@xxxxxxxxxxxxxxx>
Date: Wed, 02 Feb 2005 14:52:06 -0500
javax.vecmath download
Well my original question was out of ignorance of the existence of Saxon 8! The new features of xslt 2 and xpath 2 solved major problems and allows my project to stay neat. Tunneling parameters are cool! Solved a huge problem I was having converting for example the following mathml equation:

   <apply>
       <eq/>
       <apply>
           <csymbol type="vector">C</csymbol>
           <ci >t</ci>
       </apply>
      <apply>
           <divide/>
           <apply>
               <sum />
               <bvar>
                   <ci type="integer">i</ci>
               </bvar>
               <lowlimit>
                   <cn>0</cn>
               </lowlimit>
               <uplimit>
                   <ci type="integer">n</ci>
               </uplimit>
               <apply>
                   <times/>
                   <apply>
                       <selector/>
                       <ci>w</ci>
                       <ci>i</ci>
                   </apply>
                   <apply>
                       <selector/>
                       <ci type="vector">d</ci>
                       <ci>i</ci>
                   </apply>
                   <apply>
                       <csymbol>N</csymbol>
                       <ci type="integer">i</ci>
                       <ci type="integer">p</ci>
                       <apply>
                           <selector/>
                           <ci>knot</ci>
                           <ci type="integer">i</ci>
                       </apply>
                       <ci>t</ci>
                   </apply>
               </apply>
           </apply>
           <apply>
               <sum />
               <bvar>
                   <ci type="integer">i</ci>
               </bvar>
               <lowlimit>
                   <cn>0</cn>
               </lowlimit>
               <uplimit>
                   <ci>n</ci>
               </uplimit>
               <apply>
                   <times/>
                   <apply>
                       <selector/>
                       <ci>w</ci>
                       <ci>i</ci>
                   </apply>
                   <apply>
                       <csymbol>N</csymbol>
                       <ci type="integer">i</ci>
                       <ci>p</ci>
                       <apply>
                           <selector/>
                           <ci>knot</ci>
                           <ci type="integer">i</ci>
                       </apply>
                       <ci>t</ci>
                   </apply>
               </apply>
           </apply>
       </apply>
   </apply>

to compilable and runnable at runtime Java code:

public javax.vecmath.GVector C(double t)
{
javax.vecmath.GVector C=null;
C=divide((new com.pombi.mathml.lang.OperatorAdapter(){ public javax.vecmath.GVector vectorSum(double t){
javax.vecmath.GVector sum=new javax.vecmath.GVector(3);
for(int i=0;i<=n;i++)
{
sum.add(times(new Object[]{w[(int)i],d[(int)i],N(i, p, knot, t)}));
}
return sum;
}}).vectorSum(t),(new com.pombi.mathml.lang.OperatorAdapter(){ public double sum(double t){
double sum=0.0;
for(int i=0;i<n;i++)
{
sum+=((w[(int)i]*N(i, p, knot, t)));
}
return sum;
}}).sum(t));
return C;
}


Isn't that sweet?! I recommend anybody out there to go to Saxon (8.2) and work with xslt 2.0 and xpath 2.0. Whole new world instead of trying to write extensions on other processors! Where tunneling parameters came in incredibly handy is the reuse of the parameter list and arguments from the math:csymbol definition to the inner class built for the math:sum element. double t from C(double t) passed to double sum(double t) and then the arguments can go to the inner class all nice and neat!

-Roger

P.S. Thanks Michael Kay!

JBryant@xxxxxxxxx wrote:

Curiousity question: is anyone extending toward xslt 2.0 and xpath 2.0?



Check out Saxon 8. It implements the current draft of XSLT 2 and XPATH 2.


Jay Bryant
Bryant Communication Services
(on contract at Synergistic Solution Technologies)

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.