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

RE: Can XSLT remember the occurrence

Subject: RE: Can XSLT remember the occurrence
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sun, 4 Jan 2004 17:28:56 +0100
math operation xslt power
> -----Original Message-----
> From: suresh reddy
>
<snip />
>
> Can I write an XSL so that the output is the following
> ..
>
> <html>
> <body>
> e power x power base i
> </body>
> </html>
>

In this case, the following templates should do the trick:

<xsl:template match="/">
  <html>
  <xsl:apply-templates select="math/msup" />
  </html>
</xsl:template>

<xsl:template match="msup">
  <body>
  <xsl:apply-templates select="mrow/msub/mi[1]" />
  </body>
</xsl:template>

<xsl:template match="mrow/msub/mi">
  <xsl:value-of select="ancestor::msup/mi" />
  <xsl:text> power </xsl:text>
  <xsl:value-of select="." />
  <xsl:text> power base </xsl:text>
  <xsl:value-of select="following-sibling::mi[1]" />
</xsl:template>

> Can anyone please help me... the solution should be
> more generalized .... the above is just a simple
> instance I have chosen.. the expression can be very
> complex and every variable should be expressed with
> respect to the ground variable.
>

I think you will find the 'ancestor::msup/mi' XPath expression particularly
helpful. The above example only works for this specific case, so I
definitely hope there is at least some other way to distinguish between the
types of operation (i.e. power).

Hope this helps! (If not, don't hesitate to re-post)

Cheers,

Andreas


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


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.