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

Re: Inserting the value of a variable in a result-doc

Subject: Re: Inserting the value of a variable in a result-document
From: "Spencer Tickner" <spencertickner@xxxxxxxxx>
Date: Mon, 30 Apr 2007 15:49:22 -0700
Re:  Inserting the value of a variable in a  result-doc
Hi David,

Thanks for the advice on the document. I'll implement that part. The
reason I'm doing it with a named template is that this is part of a
larger transformation in which new files are created based on
realtionships in other files. IE, the file and insertion string will
change each time. Sorry but looking back my original example doesn't
really get that across. It would have been more correct to have
something like:

<xsl:call-template name="insert_node">
<xsl:with-param name="myNode" select="$Node"/>
<xsl:with-param name="myInputDoc" select="document($File)"/> <!--
Thanks David -->
<xsl:with-param name="myResultsFile" select="$newFile"/>
</xsl:call-template>

Where the various variables are based on conditions the call-template
is wrapped in.

Thanks,

Spencer
On 4/30/07, David Carlisle <davidc@xxxxxxxxx> wrote:

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

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.