Loading an external file of index

Subject: Loading an external file of index
From: Pierre Attar <patt@xxxxxxxxx>
Date: Thu, 22 Jun 2000 09:55:45 +0200
Hi,

I have a lot fo files that are using a shared common index for managing references. Something like :

1) lot of files with contents like :

<xmlfile><p>Here I want to define the <keyref linkend="xml"/> standard</p></xmlfile>

2) an other file called shared.xml with :

<keysbase>
<key name="xml"><acronym>xml</acronym><title>eXtended Markup Language</title></key>
<key name="xsl"><acronym>xsl</acronym><title>eXtended Style Sheet Language</title></key>
</keysbase>



What I want to do is, while formatting my xml files to HTML, is to load first the shared.xml file for getting as a set of keys in order to be able to use it for formatting all files.


In XSL T, it is something like :

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
        <xsl:output method="html" indent="no"/>

<xsl:template match="/">
<xsl:apply-templates select="document('../shared/shared.xml')"/>
<xsl:apply-templates/>
</xsl:template>


....

<xsl:template match="keyref">
<b><xsl:value-of select="key('mysetofkeys',@name)/ACRONYM"/></b>
</xsl:template>


....

</xsl:stylesheet >

My problem is that the standard says that the <xsl:key> declaration needs to be at the top root node level of a stylesheet and that at this time, the key elements coming from the imported file are unknown.

So, the question is where do I declare <xsl:key name="mysetofkeys" match="key" use="@name"/> for being able to fill the table with all keys from the imported file ?

Regards,

Pierre

PS : By the way, an other subconsequent question is how is it possible, for debugging purpose, to output the content of a key table ? Something like print(key("mysetofkeys')) ... ?


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



Current Thread