[xsl] Handling dependency hierarchy in stylesheets

Subject: [xsl] Handling dependency hierarchy in stylesheets
From: "Dr. Patrik Stellmann patrik.stellmann@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 11 Feb 2018 09:16:25 -0000
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.Stellmann@xxxxxxxxx<mailto:Patrik.Stellmann@xxxxxxxxx>


GDV Dienstleistungs-GmbH
GlockengieCerwall 1
D-20095 Hamburg
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, in-formieren 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 im-mediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

Current Thread