Thanks for the explanations, Michael.
So I will try again using packages…
At least I’m sure now I didn’t miss anything obvious.
Regards,
Patrik
------------------------------------------------------------------
Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail:
Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de<mailto:Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de>
Von: Michael Kay mike(_at_)saxonica(_dot_)com
[mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Gesendet: Sonntag, 11. Februar 2018 10:38
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: Re: [xsl] Handling dependency hierarchy in stylesheets
Your function-available() idea is neat but it doesn't work. Firstly you missed
out the quotes
use-when="not(function-available('my:common-base-included'))"
but more importantly, the static context for use-when does not include
stylesheet functions so this will always be false. This rule is to prevent
circularity: you can't know what stylesheet functions are available until you
have evaluated all the use-when attributes. In XSLT 3.0, however, configuring
it using a use-when attribute that refers to a static variable would work.
If you use import rather than include, then you don't get the errors due to
components being declared more than once, but you do get other problems: you
end up with template rules present with more than one import precedence which
plays havoc with xsl:next-match (quite apart from being a nightmare for the
processor to implement efficiently).
One approach (if you're not going to use import precedences and next-match) is
to declare none of the dependencies in the module itself, but instead, for each
configuration of modules that you actually want to use in combination with each
other, maintain a top-level module that does nothing other than xsl:include
everything required.
I would hope you can look again at packages. Yes, the configuration issues
complicate matters - but no more so than the use of catalogs which are widely
used with complex include/import structures.
Michael Kay
Saxonica
On 11 Feb 2018, at 09:16, Dr. Patrik Stellmann
patrik(_dot_)stellmann(_at_)gdv-dl(_dot_)de<mailto:patrik(_dot_)stellmann(_at_)gdv-dl(_dot_)de>
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com<mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>>
wrote:
Hi,
I have multiple small utility xslt files that I use in several other
stylesheets with xsl:include – which works fine when there is a very flat
hierarchy. But I found no comfortable way with a scenario like this:
- common-base.xsl has no dependencies.
- common-1.xsl and common2.xsl both require common-base.xsl
- main.xsl requires common1.xsl and common-2.xsl
So I have to include common-1 and common-2 in main. But how do I deal with
common-base?
I would like to include common-base in common-1 and common-2 – because this is
where the dependency actually is. But then this file is included twice in main!?
Currently I kind of solved this by not including common-base in common-1 and
common-2 but directly in main. But this way I always to have include
common-base as well as when using common-1 or common-2. And in reality there
are much more dependencies so this is very annoying.
Using packages also seems to be no option for me since – as far as I understood
it – their need to be registered and I don’t always have easy access to the
configuration.
Another approach was to do something like the common #ifndef from C/C++ headers
by using the @use-when on the root xsl:stylesheet:
use-when="not(function-available(my:common-base-included))"
But I get an error “XPDY0002: Error in use-when expression. The context item is
absent”. So I guess I cannot use this on the root element.
This issue seems to be very common so I’d expect there to be a good solution
but I couldn’t find it…
Any suggestions?
Thanks and regards,
Patrik
------------------------------------------------------------------
Systemarchitektur & IT-Projekte
Tel: +49 40 33449-1142
Fax: +49 40 33449-1400
E-Mail:
Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de<mailto:Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de>
GDV Dienstleistungs-GmbH
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de<http://www.gdv-dl.de/>
Niederlassungen:
Wilhelmstraße 43 / 43 G
10117 Berlin
Frankenstraße 18a
20097 Hamburg
Sitz und Registergericht: Hamburg
HRB 145291
USt.-IdNr : DE 205183123
Geschäftsführer:
Dr. Jens Bartenwerfer
Michael Bathke
Fred di Giuseppe Chiachiarella
Thomas Fischer
Aufsichtsratsvorsitzender: Werner Schmidt
------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe der E-Mail ist nicht gestattet.
This e-mail and any attached files may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<-list/293509> (by email)
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<-list/2718916> (by email<>)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--