[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] XSLT 3.0: Are modes containing only templates that match a node?
Subject: Re: [xsl] XSLT 3.0: Are modes containing only templates that match a node? From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 21 Dec 2014 21:11:19 -0000 |
Comment lodged here: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27682 Michael Kay Saxonica mike@xxxxxxxxxxxx +44 (0) 118 946 5893 On 21 Dec 2014, at 19:21, Dimitre Novatchev dnovatchev@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > In section "6.6 Modes" of the 2nd Last Call of the W3C XSLT 3.0 > specification (http://www.w3.org/TR/2014/WD-xslt-30-20141002/#modes) > we read: > > "[Definition: Modes allow a node in a source tree to be processed > multiple times, each time producing a different result. They also > allow different sets of template rules to be active when processing > different trees, for example when processing documents loaded using > the document function (see 20.1 fn:document) or when processing > temporary trees". > > > > This is true, but the definition mentions only processing "a node" and > leaves out the fact that a mode may contain templates that match an > atomic item or a function. > > In the whole text throughout this section, only processing of nodes is > mentioned and this leaves the perception that it isn't allowed for a > mode to contain templates that match non-node items. > > In case this perception is sound, the specification should explicitly > say so, in order to eliminate the currently arising confusion and > questions like this one. > > I verified that actually a template that matches an atomic item can be > part of a mode -- for example the following transformation runs > without a problem and produces the expected, correct result. > > In case templates matching a non-node item are allowed as part of a > mode, then the current text of section 6.6 can be improved, by > explicitly acknowledging this fact, and replacing any generic > mentioning of "node" with "item". > > <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" expand-text="yes"> > <xsl:output method="text"/> > > <xsl:variable name="vNums" select="1 to 10"/> > > <xsl:template match="/"> > <xsl:apply-templates select="$vNums" mode="squares"/> > <xsl:text>
</xsl:text> > <xsl:apply-templates select="$vNums" mode="cubes"/> > </xsl:template> > > <xsl:template match=".[. instance of xs:integer]" mode="squares"> > <xsl:sequence select=". * ."/> > </xsl:template> > > <xsl:template match=".[. instance of xs:integer]" mode="cubes"> > <xsl:sequence select=". * . * ."/> > </xsl:template> > </xsl:stylesheet> > > > -- > Cheers, > Dimitre Novatchev
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSLT 3.0: Are modes containin, Dimitre Novatchev dn | Thread | [xsl] Re: XSLT 3.0: Are modes conta, Michael Kay mike@xxx |
[xsl] Re: XSLT 3.0: Are modes conta, Michael Kay mike@xxx | Date | [xsl] XSLT 3.0: Conflicting text de, Dimitre Novatchev dn |
Month |
Keywords