[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Mode in XSLT 3.0

Subject: Mode in XSLT 3.0
From: "Toshihiko Makita tmakita@xxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 22 Jul 2017 14:58:00 -0000
 Mode in XSLT 3.0
Hi list,

I'm testing to convert XSLT 2.0 stylesheet modules that have xsl:template with @match attributes to XSLT 3.0 packages. They belong DITA-OT plug-in and generates XSL-FO from DITA maps and topics.
Most of templates are defined with no @mode attributes which means that they are defined as default mode.
In XSLT 3.0 package if a template is declared without no @mode attribute, it is assumed to be "#unnamed" and "#unnamed" mode must be @visibility="hidden".
Consequently if we want declare templates in a library package as public, we must declare mode explicitly as following:


<xsl:package name="urn:package:a" default-mode="MODE_NORMAL" version="3.0">
  <xsl:mode name="MODE_NORMAL" visibility="public"/>
  <xsk:template match="v">b&</xsl:template>
  <xsk:template match="w">b&</xsl:template>
</xsl:package>

<xsl:package name="urn:package:b" default-mode="MODE_NORMAL" version="3.0">
  <xsl:mode name="MODE_NORMAL" visibility="public"/>
  <xsk:template match="x">b&</xsl:template>
  <xsk:template match="y">b&</xsl:template>
</xsl:package>

The first package:

  <xsl:use-package name="urn:package:a"/>
  <xsl:use-package name="urn:package:b"/>

However XSLT 3.0 specification says that mode name should be unique between library packages.

https://www.w3.org/TR/xslt-30/#named-components

"The components which can be declared in one package and referenced in another are: functions, named templates, attribute sets, modes, and global variables and parameters."

"[Definition: Two components are said to be homonymous if they have the same symbolic identifier.]"

"[ERR XTSE3050] It is a static error if the xsl:use-package elements in a package manifest cause two or more homonymous components to be accepted with a visibility other than hidden."

According to the specification, I found it is not useful to apply xsl:package for the XSLT 2.0 modules that have default mode templates. Is my understanding accurate?

--
/*--------------------------------------------------
 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 --------------------------------------------------*/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.