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

Re: How to use document() of doc() function with copy

Subject: Re: How to use document() of doc() function with copy idiom, or how to acc
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 25 Jul 2006 16:40:31 +0100
Re:  How to use document() of doc() function with copy
> I replaced it with <xsl:copy-of select="doc(xxx)" /> and now it works.

It works, but it's very expensive on memory. You end up with two copies
of your input document in memory, the first one, loaded with doc() and
a second new document  stored in $documents that has a different
structure and _copies_ of all the nodes of the first.

It's not clear why you need to wrap your source document in a new <doc>
element before applying templates, if instead you wrnt

<xsl:variable name="document" select="document($input-file)"/>

then $document would be the (original) document node.
You would then just generate the <doc> element on output, 

    <xsl:template name="main" match="/">
        <output>
            <doc>
                <input-filename><xsl:value-of select="." /></input-filename>
                <xsl:apply-templates select="$document/*" mode="copy" />
            </doc>
        </output>
    </xsl:template>
   
David

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.