Re: [xsl] Mode in XSLT 3.0

Subject: Re: [xsl] Mode in XSLT 3.0
From: "Toshihiko Makita tmakita@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 23 Jul 2017 23:08:44 -0000
> If that's what you're trying to achieve, then it isn't going to work: you're trying to create packages that aren't sufficiently independent of each other.

The insufficiency comes form XML document (DITA) content model itself. For instance:

- concept/body can contain dl, ol, ul, p, table, etc...
- p can contain inline elements ph, b, i, u, sup, sub. It also can contain block elements dl, ol, ul, table.
- Inline elements ph, b, i, u can contain each other.
- table/tgroup/tbody/row/entry can contain inline elements ph, b, i, u, sup, sub. It also can contain block elements dl, ol, ul, table.


The content model is recursively defined. So it will be difficult to make independent package unless forcing all of the element template to be written in one package.
Are there any effective ways to apply XSLT functions to this type of template modules?



On 2017/07/23 1:10, Michael Kay wrote:
The design doesn't allow you to construct a mode by combining template rules from two different packages, except for the specific case where a using package adds overriding template rules to a mode that is defined in a used package. If that's what you're trying to achieve, then it isn't going to work: you're trying to create packages that aren't sufficiently independent of each other.

The thinking is that if package A uses packages B and C, then B and C were developed and tested independently and have no knowledge of each other or dependence on each other. When a template rule in B calls apply-templates, it's not expecting a template rule in C to be invoked, because it was written with no knowledge of C.

If B and C are designed to process different kinds of document, but both were written to use the unnamed mode, then to turn them into packages it is probably best to add a default-mode attribute to the xsl:package element, as you have done: but you need to use different mode names in the two packages. This has the effect that all template rules and apply-templates calls that don't specify a mode are now using the default mode, which can be different for the two packages; and since the two modes now have different names, both can be visible in the using package A.

That's the thinking anyway. How well it works in practice is something that I hope we will discover as the user community shares its experiences.

Michael Kay
Saxonica

-- /*-------------------------------------------------- Toshihiko Makita Development Group. Antenna House, Inc. Ina Branch E-Mail tmakita@xxxxxxxxxxxxx 8077-1 Horikita Minamiminowa Vil. Kamiina Co. Nagano Pref. 399-4511 Japan Tel +81-265-76-9300 Fax +81-265-78-1668 Web site: http://www.antenna.co.jp/ http://www.antennahouse.com/ --------------------------------------------------*/

Current Thread