This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: determining position of a document included using document function


Thanks Gennady, that's useful.
>For example, using the following XML file

><?xml version="1.0" ?>
><files>
>   <file href="data1.xml" />
>   <file href="data2.xml" />
>   <file href="data3.xml" />
></files>

>I declare a variable, which is a union of the documents
><xsl:variable name="merged" select="document(/files/file/@href)" />

>Then I store generated id for each document root in another variable:

><xsl:variable name="tops">
> <xsl:for-each select="/files/file">
>  <file>
>   <xsl:copy-of select="@href" />
>   <xsl:attribute name="id"><xsl:value-of
>select="generate-id(document(@href))" /></xsl:attribute>
>  </file>
> </xsl:for-each>
></xsl:variable>

>When I need to know the file URL, I do the following:
><xsl:template match="myElement">
>...
> <xsl:variable name="currentTop" select="generate-id(/)" />
> <url>
>  <xsl:value-of select="msxsl:node-set($tops)/file[@id =
$currentTop]/@href"
>/>
> </url>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]