This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: More efficient way than following-sibling?
- From: Wendell Piez <wapiez at mulberrytech dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 20 Mar 2002 16:26:24 -0500
- Subject: Re: [xsl] More efficient way than following-sibling?
- Reply-to: xsl-list at lists dot mulberrytech dot com
Michael,
This is not all that big a deal, but what you have is much the same as:
<xsl:apply-templates select="$TheNode/following-sibling::*[1]" mode="generic"/>
and then, instead of a template called by name, a mode:
<xsl:template match="*" mode="generic">
...
</xsl:template>
This will work since the apply-templates will simply fail in the event that
no first following sibling element exists. So you don't have to wrap the
call in a conditional.
Is that something like what you were after?
But it's the following:: axis that's the real killer, not following-sibling::.
Cheers,
Wendell
At 02:45 PM 3/20/2002, you wrote:
>I am trying to find a more efficient way to determine if a node has
>siblings, and then access the next sibling.
>
>Currently, I am running the following XSLT code:
>
><xsl:if test="$TheNode/following-sibling::node()">
> <xsl:call-template name="GenericTemplate">
> <xsl:with-param name="TheNode" select="$TheNode/following-sibling::*[1]"/>
> </xsl:call-template>
></xsl:if>
>
>However, this is very expensive, when it comes to large XML documents.
>
>Does anyone know a more efficient way to do this?
>
>--Michael Glick
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list