xsl-list
[Top] [All Lists]

RE: [xsl] saxon:evaluate from external to current source

2007-05-08 14:22:47
I'm guessing, but I imagine that the feedback element is the outermost
element of the source.xml document and this is the principal input document
of your stylesheet.

If I've guessed correctly, then you want a global variable

<xsl:variable name="root" select="/">

and you then want to do:

<xsl:for-each select="$formfields/field">
    <xsl:variable name="currpath" as="xs:string" select="@srcPath"/>
    <xsl:apply-templates select="$root/saxon:evaluate($currpath)"/>
</xsl:for-each>
 
Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Matt Stoeffler [mailto:mstoef(_at_)jstor(_dot_)org] 
Sent: 08 May 2007 20:37
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] saxon:evaluate from external to current source 

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.


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>