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

RE: ancestor

Subject: RE: ancestor
From: "Jiang, Peiyun" <Peiyun.Jiang@xxxxxxxxxxxxxx>
Date: Mon, 18 Oct 2004 12:54:56 -0400
xsl ancestor
Thanks, everyone!

I picked up "inlineequation[not(ancestor::table)]" because it looks neat and
it works!!!
Testing for ancestor does not seem to slow down my application. The // part
probaly is the critical "PATH" as Jeni said. My "inlineequation" is all over
the document nesting with different depths and I'll use "//" for now. 

The pain part is this (though my XSLT is not too slow as measured on my
computer): 
I'm trying to output the position of each selected inlineequation (using
inlineequation[not(ancestor::table)]). The numbering is sequential in the
selected inlineequations. What I'm doing is when each inlineequation is
matched, I call a template that will get the position in the selected list.
"inlineequation[not(ancestor::table)]" is evaluated over and over again.

template:
  <xsl:template name="inlineequation_position">
     <xsl:param name="inlineequation"></xsl:param>
     <xsl:for-each select="//inlineequation[not(ancestor::table) and
not(ancestor::figure)]">
        <xsl:if test="$inlineequation/@id=./@id"><xsl:value-of
select="position()" /></xsl:if>
     </xsl:for-each>
  </xsl:template>

simplified calling template:
  <xsl:template match="inlineequation">
    <img alt="">
       <xsl:attribute name="src">ImgServer?<xsl:call-template
name="inlineequation_position"><xsl:with-param
name="inlineequation" select="."/></xsl:call-template>h.gif</xsl:attribute>
    </img>     
  </xsl:template>  

Is there a way to cache the result of
"//inlineequation[not(ancestor::table)]" in a variable and pass it to the
template? There seems to be two problems with this approach: a global
variable may not have access to the document and can we pass two parameters
to a template?

Thanks.

Peiyun Jiang

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.