Keys across multilple input files

Subject: Keys across multilple input files
From: Ann Marie Rubin - Sun PC Networking Engineering <Annmarie.Rubin@xxxxxxxxxxxx>
Date: Fri, 2 Jun 2000 10:16:31 -0400 (EDT)
Hello all,

I have an XSL stylesheet that transforms the CLASS elements contained in a single XML file and 
outputs an html file for each CLASS.  CLASS elements are hierarchical. Each CLASS has an 
attribute that contains the name of its parent CLASS.  The stylesheet generates keys for the 
CLASS elements and searches those keys to generate a list of the ancestors and descendents of 
each CLASS element.

Now I want to revise this stylesheet to transform the same CLASS elements when each CLASS is in a 
separate XML file.  My questions are:

1.  Can I use the xsl:key element to generate keys for CLASS elements that are each contained in 
separate files?  filelist.xml is a file containing a list of the names of the XML class files.
I tried the following:

<xsl:for-each select="document('filelist.xml')">
<xsl:key name="classes" match="class" use="@NAME"/>

This fails because the <xsl:for-each> statement must be within a template. But the <xsl:key> 
statement must be a child of the stylesheet element.  Is this possible?  How?

2.  Can I generate the keys for all CLASS elements in one XSL process and save them, so that 
another XSL process can access these keys?  

For example, the first time a stylesheet processes an XML class file, it generates the keys for 
all the CLASS elements in all the XML files and saves the keys.  Each subsequent time the 
stylesheet is used to process an XML class file, the stylesheet can access the keys generated by 
the previous processing.

Is this possible? Is there a more efficient way to handle this?

Thanks for your ideas.

Ann Marie

 XSL-List info and archive:

Current Thread