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

Subject: Re: [xsl] selecting specific elements from a second file
From: "Mark Wilson mark@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 17 Dec 2016 16:13:13 -0000
Thanks
Mark

On 12/17/2016 9:05 AM, Graydon graydon@xxxxxxxxx wrote:
On Sat, Dec 17, 2016 at 03:37:38PM -0000, Mark Wilson mark@xxxxxxxxxxxx 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

Current Thread