Subject: AW: [xsl] Handling dependency hierarchy in stylesheets From: "Dr. Patrik Stellmann patrik.stellmann@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 13 Feb 2018 05:24:40 -0000 |
Thanks for the explanations, Michael. So I will try again using packagesb& At least Ibm sure now I didnbt miss anything obvious. Regards, Patrik ------------------------------------------------------------------ Systemarchitektur & IT-Projekte Tel: +49 40 33449-1142 Fax: +49 40 33449-1400 E-Mail: Patrik.Stellmann@xxxxxxxxx<mailto:Patrik.Stellmann@xxxxxxxxx> Von: Michael Kay mike@xxxxxxxxxxxx [mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx] Gesendet: Sonntag, 11. Februar 2018 10:38 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 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.stellmann@xxxxxxxxx<mailto:patrik.stellmann@xxxxxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx<mailto:xsl-list-service@xxxxxxxxxxxx rytech.com>> wrote: Hi, I have multiple small utility xslt files that I use in several other stylesheets with xsl:include b 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 b 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 b as far as I understood it b their need to be registered and I donbt 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 bXPDY0002: Error in use-when expression. The context item is absentb. So I guess I cannot use this on the root element. This issue seems to be very common so Ibd expect there to be a good solution but I couldnbt find itb& Any suggestions? Thanks and regards, Patrik ------------------------------------------------------------------ Systemarchitektur & IT-Projekte Tel: +49 40 33449-1142 Fax: +49 40 33449-1400 E-Mail: Patrik.Stellmann@xxxxxxxxx<mailto:Patrik.Stellmann@xxxxxxxxx> GDV Dienstleistungs-GmbH GlockengieCerwall 1 D-20095 Hamburg www.gdv-dl.de<http://www.gdv-dl.de/> Niederlassungen: WilhelmstraCe 43 / 43 G 10117 Berlin FrankenstraCe 18a 20097 Hamburg Sitz und Registergericht: Hamburg HRB 145291 USt.-IdNr : DE 205183123 GeschC$ftsfC<hrer: Dr. Jens Bartenwerfer Michael Bathke Fred di Giuseppe Chiachiarella Thomas Fischer Aufsichtsratsvorsitzender: Werner Schmidt ------------------------------------------------------------------ Diese E-Mail und alle AnhC$nge enthalten vertrauliche und/oder rechtlich geschC<tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtC<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<>)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Handling dependency hiera, Michael Kay mike@xxx | Thread | [xsl] fn:document() cost, Jacopille, David dja |
Re: [xsl] Schema validation on a fu, Michael Kay mike@xxx | Date | [xsl] Using QNames as keys in maps, Erik Siegel erik@xxx |
Month |