Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] Processing multiple documents

From: Florent Georges <lists@------------>
To:
Date: 3/1/2008 12:21:00 PM
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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent