Hi, Mukul.

"Mukul Gandhi" <[EMAIL PROTECTED]> wrote on 2008-04-18 04:16:12 AM:
> So you have this code ...
> 
> <xsl:variable name="external" select="document('ext.xml')"/>
> <xsl:variable name="fragment">
>   <xsl:for-each select="$external">
>     <xsl:copy-of select="key(...)"/>
>   </xsl:for-each>
> </xsl:variable>
> 
> Here, <xsl:for-each select="$external"> will not be much useful, as it
> represents the root node of the external document (ext.xml). This
> actually selects 1 node (which is the root node).
> 
> Something like this could be useful:
> <xsl:for-each select="$external/a/b/c">
> 
> Also, they key() function at this position will operate on the tree
> formed by ext.xml and not on the primary document. Is this what you
> need?

That's exactly the reason for using something like <xsl:for-each 
select="$external"> as in Peter's example - even though it iterates over 
exactly one node, it's the only convenient way of setting the context node 
to be the root of another document so that the key() function or id() 
function will select nodes in that document.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro
XML Transformation & Query Development
IBM Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]

Reply via email to