xsl-list
[Top] [All Lists]

RE: Can XSLT remember the occurrence

2004-01-04 09:28:56
-----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



<Prev in Thread] Current Thread [Next in Thread>