[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: 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
|
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
|