|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: A little cross referencing problem
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
|
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
|

Cart








