Keys across multilple input files
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"/> </xsl:for-each> 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: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format