[xsl] saxon:evaluate from external to current source

Subject: [xsl] saxon:evaluate from external to current source
From: Matt Stoeffler <mstoef@xxxxxxxxx>
Date: Tue, 8 May 2007 15:37:04 -0400
There was a posting in April--see http://www.biglist.com/lists/xsl- list/archives/200704/threads.html#0022-- in which a question was posed about establishing proper context for saxon:evaluate for an external document. I have a problem that inverts that one somewhat. I'm working on xsl that uses a reference xml file to direct the order in which to process a source document. So, when processing source.xml, I reference an external map.xml, which looks like this ...

<field-map form="Secondary School Participation">
<field srcPath="feedback/nameInfo/title" resId="courtesyTitle">Courtesy Title</field>
<field srcPath="feedback/nameInfo/name" resId="nameHead">Name</field>
<field srcPath="feedback/nameInfo/email" resId="emailHead">Email</field>


...
</field-map>

The reference map.xml tells me what source nodes to process in what order. My problem arises when I change context in the xsl file ...

where $formfields gets me the nodeset from the external document I want, depending on the form I want to process.

<xsl:for-each select="$formfields/field">
   <xsl:variable name="currpath" as="xs:string" select="@srcPath"/>
   <xsl:apply-templates select="/saxon:evaluate($currpath)"/>
 </xsl:for-each>


... problem is, the saxon:evaluate fails because, I suspect, I'm in the wrong document context. How can I tell my apply-templates instruction to evaluate the path in the source document?


thanks.

Matt.

Current Thread