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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--