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

Inserting the value of a variable in a result-document

Subject: Inserting the value of a variable in a result-document
From: "Spencer Tickner" <spencertickner@xxxxxxxxx>
Date: Mon, 30 Apr 2007 15:26:11 -0700
 Inserting the value of a variable in a result-document
Hi List,

Thanks in advance for the help. Not sure why I'm having such a tough
time with this one, but here it goes. I'm using Saxon and XSLT 2.0.

Basically  I have a named template I'm calling that inserts a node
into a  bunch of small xml documents. Hoewever I'm not sure how to do
this as the param comming in is out of scope if I was to
apply-templates:

so if I started with:

file:///c:/test.xml
<root>
<foo>
  <bar>of the foo variety</bar>
  <insert>insert the text after this</insert>
 <foo>
   <bar>A deeper bar who is foo</bar>
 </foo>
</foo>
</root>

and wanted

file:///c:/test_new.xml
<root>
<foo>
  <bar>of the foo variety</bar>
  <insert>insert the text after this</insert>
  the new insert
 <foo>
   <bar>A deeper bar who is foo</bar>
 </foo>
</foo>
</root>

and had the template:


<xsl:template name="insert_node"> <xsl:param name="myNode"/> <xsl:param name="myInputDoc"/> <xsl:param name="myResultsFile"/> <xsl:variable name="inDoc" select="document($myInputDoc)"/>

 <xsl:result-document href="{$myResultsFile}">
  <!-- Here I'm not sure what to do with $inDoc, apply-templates with
a mode makes me lose $myNode and a for-each doesn't keep my original
structure -->
  </xsl:result-document>
</xsl:template>


an called my template with



<xsl:call-template name="insert_node"> <xsl:with-param name="myNode">the new insert</xsl:with-param> <xsl:with-param name="myInputDoc">file:///c:/test.xml</xsl:with-param> <xsl:with-param name="myResultsFile">file:///c:/test_new.xml</xsl:with-param> </xsl:call-template>


What would be the best way to do this.


Thanks,

Spencer

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-2007 All Rights Reserved.