[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Using variables in extension elements
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?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|