Subject: [xsl] Re: A little cross referencing problem From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Wed, 22 Aug 2001 20:33:39 -0700 (PDT) |
Joerg Pietschmann wrote: > Jeni Tennison <mail@xxxxxxxxxxxxxxxx> wrote: > > Very sweet :) You could do the same kind of thing for decimal formats > > to use with format-number(). > > > > Of course the only slight drawback is that the document('') call will > > only get the current stylesheet document, and therefore won't search > > for keys defined in imported or included stylesheets (or indeed > > stylesheets in which this one is imported or included). > > > > Perhaps functions like key-available() and decimal-format-available() > > would be handy. > > Yes. Either this or having something like document(/..) meaning the > whole compiled style sheet... or, for more fun, document('xsl:this')... > > Really hard-core XSLers will, of course, use recursive templates > to search all included and imported files. Bonus points for buildung > a global variable which holds all top-level xsl elements from the > transitive closure as a node set. :-) Here's a very simple collection of two templates (not at all hard-core!) that will merge together all stylesheets (of a stylesheet module) that are referenced from a main stylesheet directly or indirectly via xsl:include or xsl:import. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" /> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()" /> </xsl:copy> </xsl:template> <xsl:template match="xsl:include | xsl:import"> <xsl:apply-templates select="document(@href)/*/node()"/> </xsl:template> </xsl:stylesheet> In the first pass you apply these templates to the root of any stylesheet and get the output of this transformation into an xsl:variable. In the second pass (xxx:node-set() will have to be used just once) you convert this to a node-set and freely search for whatever xsl:key or other elements are of importance. Hope this helped. Cheers, Dimitre Novatchev. __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] IE browsers, cutlass | Thread | [xsl] Counting only some children o, Christian Cäsar |
RE: [xsl] IE browsers, Rosa I-Ting Cheng | Date | RE: [xsl] basic calendar date XML?, Joerg Pietschmann |
Month |