|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Processing multiple documents
Sean Tiley wrote:
Hi
> <xsl:variable name="doc2" select="document('TestScript2.xml')"/>
> <xsl:variable name="wordposition"
>select="/w:wordDocument/w:body/wx:sect/wx:sub-section/w:tbl[w:tr/w:tc/w:p/w:r/w:t
> = 'Test Case ID #']"/>
> [...]
> <xsl:apply-templates select="$wordposition"/>
> <xsl:apply-templates select="$doc2/$wordposition"/>
$wordposition is not a kind of path that is evaluated each time it is
used, depending on the context. The variable is bound to a sequence,
holding some values (in this case zero or more w:tbl elements).
The context item of a global variable is the document node of the
main input, so the w:tbl element is from this document. If you want
the same expression to be evaluated within the context of the second
document, use the path explicitely:
<xsl:variable name="wordposition2" select="
$doc2/w:wordDocument/w:body/..."/>
But if you want to reuse the path and evaluates it to different
contexts, use a function:
<xsl:function name="my:word-position" as="element(w:tbl)">
<xsl:param name="doc" as="document-node()"/>
<xsl:sequence select="
$doc2/w:wordDocument/w:body/wx:sect/wx:sub-section/w:tbl[
w:tr/w:tc/w:p/w:r/w:t = 'Test Case ID #' ]"/>
</xsl:function>
and use it like that:
<xsl:apply-templates select="(/, $doc2)/word-position(.)"/>
Regards,
--drkm
_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






