xsl-list
[Top] [All Lists]

Re: [xsl] selecting specific elements from a second file

2016-12-17 10:05:04
On Sat, Dec 17, 2016 at 03:37:38PM -0000, Mark Wilson 
mark(_at_)knihtisk(_dot_)org scripsit:
Thank you, Martin,
Made one small change:
<xsl:template match="Stamp">
        <xsl:copy>
            <xsl:apply-templates select="@*, node(), key('flaws',
CatNumbers/@pofis-number, doc('../work/flaws3.xml'))/node()"/>
        </xsl:copy>
    </xsl:template>

The optimizer in whatever processor you are using may or may not save
you from this by realizing it should cache the results of the doc()
function, but defining a global variable (one a child of the
xsl:stylesheet element)

<xsl:variable name="flaws3" as="document-node()"
    select="doc('../work/flaws3.xml')"/>

and then doing the apply-templates as

<xsl:apply-templates select="@*, node(),
    key('flaws', CatNumbers/@pofis-number, $flaws3)/node()"/>

is likely to get you better performance.

-- Graydon
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

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