xsl-list
[Top] [All Lists]

Re: [xsl] Resolving xsl:import href on different base URIs

2020-11-03 16:43:02
On 03.11.2020 23:36, Martynas Jusevičius martynas(_at_)atomgraph(_dot_)com 
wrote:

I have a stylesheet that I want to deploy on different setups that
have different base URIs. That impacts the relative URI of the imports
of that stylesheet. For example, in one case

     <xsl:import href="../../../xsl/bootstrap/2.3.2/layout.xsl"/>

and in the other case

     <xsl:import
href="../../../../static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/layout.xsl"/>

The rest is identical. I'd like to avoid having to duplicate
stylesheets just because of this URI difference.

Is there some clever URI resolution trick I'm not seeing, or some XSLT
3.0 static features that can help here?

You could try to declare a static parameter defining the setup and use
either a shadow attribute with

  _href="{if ($setup = 'layout1') then
'../../../xsl/bootstrap/2.3.2/layout.xsl' else
'../../../../static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/layout.xsl'"

I think or use xsl:use-when checking the param on the xsl:imports.
--~----------------------------------------------------------------
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
--~--

<Prev in Thread] Current Thread [Next in Thread>