Skip to content

Commit

Permalink
Merge pull request #1149 from ndw/iss-1084
Browse files Browse the repository at this point in the history
1084 Add fos:default-description to support prose descriptions of defaults
  • Loading branch information
ndw authored Apr 16, 2024
2 parents 4a19a16 + 003a5a5 commit 83ef163
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 40 deletions.
3 changes: 2 additions & 1 deletion specifications/xpath-functions-40/src/fos.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@
<xs:element name="applies-to" type="xs:string" minOccurs="0"/>
<xs:element name="meaning" type="xs:anyType"/>
<xs:element name="type" type="xs:string"/>
<xs:element name="default" type="xs:anyType"/>
<xs:element name="default" type="xs:string" minOccurs="0"/>
<xs:element name="default-description" type="xs:anyType" minOccurs="0"/>
<xs:element name="values" minOccurs="0">
<xs:complexType>
<xs:sequence>
Expand Down
56 changes: 28 additions & 28 deletions specifications/xpath-functions-40/src/function-catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22630,7 +22630,7 @@ return $M(collation-key("a", $C))</eg></fos:expression>
case keys are compared in escaped form.
</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>If <code>validate</code> is <code>true</code> then <code>reject</code>, otherwise <code>retain</code>.</fos:default>
<fos:default-description>If <code>validate</code> is <code>true</code> then <code>reject</code>, otherwise <code>retain</code>.</fos:default-description>
<fos:values>
<fos:value value="reject">
An error is raised <errorref
Expand All @@ -22653,8 +22653,7 @@ return $M(collation-key("a", $C))</eg></fos:expression>
<fos:option key="validate">
<fos:meaning>Determines whether the generated XML tree is schema-validated.</fos:meaning>
<fos:type>xs:boolean</fos:type>
<fos:default><termref def="implementation-defined"
>Implementation-defined</termref>.</fos:default>
<fos:default-description><termref def="implementation-defined">Implementation-defined</termref>.</fos:default-description>
<fos:values>
<fos:value value="true"
>
Expand Down Expand Up @@ -27134,10 +27133,10 @@ declare function flatten(
<fos:meaning>The minimum level of the XQuery language that the
processor must support. </fos:meaning>
<fos:type>xs:decimal</fos:type>
<fos:default>The version given in the prolog of the library module; or
<fos:default-description>The version given in the prolog of the library module; or
<termref
def="implementation-defined"
>implementation-defined</termref> if this is absent.</fos:default>
>implementation-defined</termref> if this is absent.</fos:default-description>
</fos:option>
<fos:option key="location-hints">
<fos:meaning>A sequence of URIs (in the form of <code>xs:string</code> values) which may be used or ignored in an
Expand Down Expand Up @@ -27610,10 +27609,10 @@ declare function flatten(
function call. </fos:meaning>

<fos:type>xs:string</fos:type>
<fos:default>The effect of not
<fos:default-description>The effect of not
supplying a base output URI is defined by the XSLT specification; the implementation
<rfc2119>may</rfc2119> supply a default, for example the directory containing the
stylesheet, or the current working directory. </fos:default>
stylesheet, or the current working directory. </fos:default-description>
</fos:option>
<fos:option key="cache">
<fos:applies-to>1.0, 2.0, 3.0</fos:applies-to>
Expand All @@ -27631,10 +27630,11 @@ declare function flatten(
principal result document and to secondary result documents created using
<code>xsl:result-document</code>.</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default><code>document</code>, unless the relevant
<fos:default>document</fos:default>
<fos:default-description>If the relevant
<code>xsl:output</code> or <code>xsl:result-document</code> element specifies
<code>build-tree="no"</code> (applies to XSLT 3.0 only), in which case the default
is <code>raw</code>.</fos:default>
<code>build-tree="no"</code> (applies to XSLT 3.0 only), then the default
is <code>raw</code>.</fos:default-description>
<fos:values>
<fos:value value="document"
>The result is delivered as a
Expand Down Expand Up @@ -27668,15 +27668,15 @@ declare function flatten(
are to be evaluated. The destination and formatting of any such messages is
implementation-defined.</fos:meaning>
<fos:type>xs:boolean</fos:type>
<fos:default>Implementation-defined</fos:default>
<fos:default-description><termref def="implementation-defined">Implementation-defined</termref>.</fos:default-description>
</fos:option>
<fos:option key="enable-trace">
<fos:applies-to>2.0, 3.0</fos:applies-to>
<fos:meaning>Indicates whether any <code>fn:trace</code> functions in the stylesheet are to
generate diagnostic messages. The destination and formatting of any such messages is
implementation-defined.</fos:meaning>
<fos:type>xs:boolean</fos:type>
<fos:default>Implementation-defined</fos:default>
<fos:default-description><termref def="implementation-defined">Implementation-defined</termref>.</fos:default-description>
</fos:option>
<fos:option key="function-params">
<fos:applies-to>3.0</fos:applies-to>
Expand All @@ -27690,27 +27690,27 @@ declare function flatten(
<fos:applies-to>3.0</fos:applies-to>
<fos:meaning>The value of the global context item, as defined in XSLT 3.0</fos:meaning>
<fos:type>item()</fos:type>
<fos:default>The value of <code>source-node</code></fos:default>
<fos:default-description>The value of <code>source-node</code></fos:default-description>
</fos:option>
<fos:option key="initial-function">
<fos:applies-to>3.0</fos:applies-to>
<fos:meaning>The name of the initial function to be called for call-function invocation. The
arity of the function is inferred from the length of
<code>function-params</code>.</fos:meaning>
<fos:type>xs:QName</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="initial-match-selection">
<fos:applies-to>3.0</fos:applies-to>
<fos:meaning>The value of the initial match selection, as defined in XSLT 3.0</fos:meaning>
<fos:type>item()*</fos:type>
<fos:default>The value of <code>source-node</code></fos:default>
<fos:default-description>The value of <code>source-node</code></fos:default-description>
</fos:option>
<fos:option key="initial-mode">
<fos:applies-to>1.0, 2.0, 3.0</fos:applies-to>
<fos:meaning>The name of the initial processing mode.</fos:meaning>
<fos:type>xs:QName</fos:type>
<fos:default/>
<fos:default-description>none</fos:default-description>
</fos:option>
<fos:option key="initial-template">
<fos:applies-to>2.0, 3.0</fos:applies-to>
Expand All @@ -27724,28 +27724,28 @@ declare function flatten(
<fos:meaning>The name of the top-level stylesheet package to be invoked (an absolute
URI)</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="package-location">
<fos:applies-to>3.0</fos:applies-to>
<fos:meaning>The location of the top-level stylesheet package, as a relative or absolute
URI</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="package-node">
<fos:applies-to>3.0</fos:applies-to>
<fos:meaning>A document or element node containing the top-level stylesheet
package</fos:meaning>
<fos:type>node()</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="package-text">
<fos:applies-to>3.0</fos:applies-to>
<fos:meaning>The top-level stylesheet package in the form of unparsed lexical
XML.</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>

<fos:option key="package-version">
Expand Down Expand Up @@ -27850,7 +27850,7 @@ declare function flatten(
<code>initial-match-selection</code>, that is, stylesheet execution starts by
applying templates to this node.</fos:meaning>
<fos:type>node()</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>

<fos:option key="static-params">
Expand All @@ -27874,23 +27874,23 @@ declare function flatten(
parameter has any effect. If the value is a relative reference, it is resolved against
the static base URI of the <code>fn:transform</code> function call.</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="stylesheet-location">
<fos:applies-to>1.0, 2.0, 3.0</fos:applies-to>
<fos:meaning>URI that can be used to locate the principal stylesheet module. If relative, it
is resolved against the static base URI of the <code>fn:transform</code> function call.
The value also acts as the default for stylesheet-base-uri.</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="stylesheet-node">
<fos:applies-to>1.0, 2.0, 3.0</fos:applies-to>
<fos:meaning>Root of the tree containing the principal stylesheet module, as a document or
element node. The base URI of the node acts as the default for
stylesheet-base-uri.</fos:meaning>
<fos:type>node()</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="stylesheet-params">
<fos:applies-to>1.0, 2.0, 3.0</fos:applies-to>
Expand All @@ -27907,7 +27907,7 @@ declare function flatten(
<fos:meaning>The principal stylesheet module in the form of unparsed lexical
XML.</fos:meaning>
<fos:type>xs:string</fos:type>
<fos:default>n/a</fos:default>
<fos:default-description>n/a</fos:default-description>
</fos:option>
<fos:option key="template-params">
<fos:applies-to>3.0</fos:applies-to>
Expand All @@ -27916,7 +27916,7 @@ declare function flatten(
the required type of the declared parameter using the function conversion
rules.</fos:meaning>
<fos:type>map(xs:QName, item()*)</fos:type>
<fos:default/>
<fos:default-description>none</fos:default-description>
</fos:option>
<fos:option key="tunnel-params">
<fos:applies-to>3.0</fos:applies-to>
Expand Down Expand Up @@ -27946,8 +27946,8 @@ declare function flatten(
<fos:applies-to>1.0, 2.0, 3.0</fos:applies-to>
<fos:meaning>The minimum level of the XSLT language that the processor must support.</fos:meaning>
<fos:type>xs:decimal</fos:type>
<fos:default>The <code>[xsl:]version</code> attribute at the outermost level of the
stylesheet.</fos:default>
<fos:default-description>The <code>[xsl:]version</code> attribute at the outermost level of the
stylesheet.</fos:default-description>
</fos:option>

</fos:options>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@

<xsl:template match="@type[starts-with(., 'function(')]" priority="5">
<xsl:variable name="arity" select="count(tokenize(., ','))"/>
<xsl:message><xsl:copy-of select=".."/>Arity = {$arity}</xsl:message>
<!--<xsl:message><xsl:copy-of select=".."/>Arity = {$arity}</xsl:message>-->
<xsl:choose>
<xsl:when test="$arity=0">function()</xsl:when>
<xsl:when test="$arity=1">function($p)</xsl:when>
Expand Down
43 changes: 33 additions & 10 deletions specifications/xpath-functions-40/style/merge-function-specs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -547,16 +547,27 @@
</code>
</p>
</item>
<xsl:if test="fos:default">
<item>
<p>
<term>Default: </term>
<code>
<xsl:value-of select="fos:default"/>
</code>
</p>
</item>
</xsl:if>
<xsl:if test="fos:default | fos:default-description">
<xsl:choose>
<xsl:when test="not(fos:default)">
<item>
<p>
<term>Default: </term>
<xsl:apply-templates select="fos:default-description/node()"/>
</p>
</item>
</xsl:when>
<xsl:otherwise>
<item>
<p>
<term>Default: </term>
<xsl:apply-templates select="fos:default"/>
</p>
<xsl:apply-templates select="fos:default-description"/>
</item>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</ulist>
</td>
</tr>
Expand All @@ -582,6 +593,18 @@

</xsl:template>

<xsl:template match="fos:default">
<code>
<xsl:apply-templates/>
</code>
</xsl:template>

<xsl:template match="fos:default-description">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>

<xsl:template match="fos:history | fos:version"/>

<xsl:template match="processing-instruction('type')" expand-text="yes">
Expand Down

0 comments on commit 83ef163

Please sign in to comment.