This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: transforming Content Markup (not presentation) similar to MML


DC>The logic for handling precedence _ought_ be the same as in a
DC>ContentML to Presentation ML stylesheet didn't it?

Thanks, that stylesheet should prove very useful! I should be able
to use the existing precedence but I need to add more for program 
flow consturcts. MML has representation for piecewise functions,
for example absolute value:

abs(x)= -x if x<0
      = 0  if x=0
      = x  if x>0

<apply>
 <eq/>
 <apply>
  <abs/>
  <ci> x </ci>
 </apply>
 <piecewise>
  <piece>
   <apply><minus/><ci> x </ci></apply>
   <apply><lt/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
  <piece>
   <cn> 0 </cn>
   <apply><eq/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
  <piece>
   <ci> x </ci>
   <apply><gt/><ci> x </ci> <cn> 0 </cn></apply>
  </piece>
 </piecewise>
</apply>

If I wanted general purpose "if" statement for example (the same
applies to other program flow constructs), would I be better off 
introducing new elements or mutating an existing MML element? 
Consider:

if (x<0) {
  x=-x;
else if (x>0) {
  x=x;
} else 
  x=0;
}

<if>
 <condition>
  <apply>
   <lt/>
 <ci>x</ci>
 <cn>0</cn>
  </apply>
 </condition>
 <apply>
  <eq/>
  <cn>x</cn>
  <cn>x</cn>
 </apply>
<elseif>
 <condition>
  <apply>
   <gt/>
   <ci>x</ci>
   <cn>0</cn>
  </apply>
 </condition>
 <apply>
  <eq/>
  <cn>x</cn>
  <apply>
   <minus/>
   <cn>x</cn>
  </apply>
 </apply>
</elseif>
<else>
 <apply>
  <eq/>
  <cn>x</cn>
  <ci>0</ci>
 </apply>
 </else>
</if>

How badly do I abuse MML's equal operator in using it as an assignment
statement:

y=x;

<apply>
  <eq/>
  <cn>y</cn>
  <cn>x</cn>
</apply>

Has this issue been discussed elsewhere?

Regards,

Dan

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]