xsl-list
[Top] [All Lists]

Re: [xsl] efficiently detecting size of input document?

2008-08-14 02:44:20
For (2), the challenge would be how to process the first [certain
amount] of the document and no more, again without inefficiently
counting nodes.

Do a sibling-recursion identity transform:

    <xsl:template match="node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()[1]"/>
        </xsl:copy>
        <xsl:apply-templates select="following-sibling::node()[1]"/>
    </xsl:template>

    <xsl:template match="@*">
        <xsl:copy/>
    </xsl:template>

Just add a parameter which maintains the count...


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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