You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Edwards, Jayme" <JC...@software.rockwell.com> on 2000/07/14 00:07:56 UTC

xsl:variable containing result set from multiple documents

Shouldn't the following be possible? If not how can I accomplish this?

<!-- file1.xml -->

<mydoc>
  <myelem>
</mydoc>

<!-- file2.xml -->

<mydoc>
  <myelem>
</mydoc>

<!-- masterdoc.xml -->

<?xml-stylesheet type="text/xsl" href="masterdoc.xsl"?>

<mymasterdoc>
  <myinclude href="file1.xml"/>
  <myinclude href="file2.xml"/>
</mymasterdoc>

<!-- masterdoc.xsl -->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:variable name="included-myelems">
    <xsl:for-each select="/mymasterdoc/myinclude">
      <xsl:copy-of select="document(@href)/mydoc/myelem"/>
    </xsl:for-each>
  </xsl:variable>
</xsl:stylesheet>

Jayme

Re: xsl:variable containing result set from multiple documents

Posted by Gary L Peskin <ga...@firstech.com>.
Jayme --

This worked for me.

Gary

"Edwards, Jayme" wrote:
> 
> Shouldn't the following be possible? If not how can I accomplish this?
> 
> <!-- file1.xml -->
> 
> <mydoc>
>   <myelem>
> </mydoc>
> 
> <!-- file2.xml -->
> 
> <mydoc>
>   <myelem>
> </mydoc>
> 
> <!-- masterdoc.xml -->
> 
> <?xml-stylesheet type="text/xsl" href="masterdoc.xsl"?>
> 
> <mymasterdoc>
>   <myinclude href="file1.xml"/>
>   <myinclude href="file2.xml"/>
> </mymasterdoc>
> 
> <!-- masterdoc.xsl -->
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
>   <xsl:variable name="included-myelems">
>     <xsl:for-each select="/mymasterdoc/myinclude">
>       <xsl:copy-of select="document(@href)/mydoc/myelem"/>
>     </xsl:for-each>
>   </xsl:variable>
> </xsl:stylesheet>
> 
> Jayme