Re: [xsl] Inserting the value of a variable in a result-document

Subject: Re: [xsl] Inserting the value of a variable in a result-document
From: David Carlisle <davidc@xxxxxxxxx>
Date: Mon, 30 Apr 2007 23:38:52 +0100
don't do

<xsl:with-param name="myInputDoc">file:///c:/test.xml</xsl:with-param>

(which forces the system to (act as if it had to) generate a temporary
tree with a new document node with a text node child, which is expensive
to build if all you are going to do is coerce back to a string, instead
do

<xsl:with-param name="myInputDoc" select="'file:///c:/test.xml'"/>

or just pass in the document  rather than a string

<xsl:with-param name="myInputDoc" select="doc('file:///c:/test.xml')"/>


I wouldn't use named templates at all for this, just have an identity
template

<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

and a template for insert that inserts stuff:


<xsl:template match="insert">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
<xsl:text>the new insert</xsl:text>
</xsl:template>

David



________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread