xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] How to use document() of doc() function with copy idiom, or how to acc


Subject: Re: [xsl] 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

> 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
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor