Re: Resolving xsl:import href on different base URIs

"Pieter Lamers [email protected]" <[email protected]>
Newsgroups gmane.text.xml.xsl.general.mulberrytech
Organization John Benjamins Publishing Company
Message-ID <[email protected]>
interesting. can we also do

<xsl:apply-templates _mode="{$my-mode}"/> with a parametrized mode?

-p

On 04/11/2020 22:24, Martynas Jusevičius [email protected] wrote:
> Thanks for all the suggestions! A static parameter and a shadow
> attribute did the trick for me:
>
>      <xsl:param name="apl:baseUri" as="xs:anyURI" static="yes"/>
>
>      <xsl:import
> _href="{resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/layout.xsl',
> $apl:baseUri)}"/>
>
> I didn't even know they existed, learned something new about XSLT 3.0
> today :) The example in that section is pretty much what I needed:
> https://www.w3.org/TR/xslt-30/#shadow-attributes
>
>
>
> On Wed, Nov 4, 2020 at 6:29 PM Michael Kay [email protected]
> <[email protected]> wrote:
>> Two further tricks:
>>
>> (a) when you load the top-level stylesheet using new StreamSource(stream, systemId), the systemId becomes the base URI of the top-level stylesheet module, and this doesn't need to reflect the actual location of the source code.
>>
>> (b) don't forget that you can set xml:base="" on either the xsl:stylesheet element or the xsl:import element,
>>
>> Michael Kay
>> Saxonica
>>
>> On 4 Nov 2020, at 16:56, Liam R. E. Quin [email protected] <[email protected]> wrote:
>>
>> On Tue, 2020-11-03 at 22:37 +0000, Martynas Jusevičius
>> [email protected] wrote:
>>
>> Hi,
>>
>> 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"/>
>>
>>
>> In the first instance i'd consider seeing ifi could make the
>> environments closer,  and, if not, consder an external symbolic link.
>>
>> Other alternatives include
>> * using a parameter (as Martin suggested) with _href="{ ....}"
>> * using an environoment variable, also with _href
>>   xsl:import _href="{ get-environment-
>> variable('PATHTOBOOTSTRAP')}/2.3.2/layout.xsl" />
>> or whatever (if you precompile the stylesheet, though, and deploy the
>> compiled bytecode, this probably won't help)
>>
>> * using an XML Catalog
>> * using a wrapper stylesheet that calls fn:transform() on the real one,
>> after finding it.
>>
>> Liam
>>
>>
>> --
>> Liam Quin, https://www.delightfulcomputing.com/
>> Available for XML/Document/Information Architecture/XSLT/
>> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
>> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org
>>
>>
>> XSL-List info and archive
>> EasyUnsubscribe (by email)
> 

-- 
Pieter Lamers
John Benjamins Publishing Company
Postal Address: P.O. Box 36224, 1020 ME AMSTERDAM, The Netherlands
Visiting Address: Klaprozenweg 75G, 1033 NN AMSTERDAM, The Netherlands
Warehouse: Kelvinstraat 11-13, 1446 TK PURMEREND, The Netherlands
tel: +31 20 630 4747
web: www.benjamins.com
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.