[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Processing multiple documents

Subject: Re: Processing multiple documents
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Sat, 1 Mar 2008 13:20:40 +0100 (CET)
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.