Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dnovatchev/qtspecs into d…
Browse files Browse the repository at this point in the history
…n-ranks

Integration (continuous - CI)
  • Loading branch information
dnovatchev committed Nov 27, 2024
2 parents 95b7983 + dd6003c commit b32100d
Show file tree
Hide file tree
Showing 11 changed files with 436 additions and 168 deletions.
7 changes: 3 additions & 4 deletions specifications/grammar-40/xpath-grammar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1403,11 +1403,9 @@ ErrorVal ::= "$" VarName
</g:production>

<g:production name="NameTestUnion" if="xpath40 xquery40">
<g:ref name="NameTest"/>
<g:zeroOrMore>
<g:string>|</g:string>
<g:oneOrMore separator="|">
<g:ref name="NameTest"/>
</g:zeroOrMore>
</g:oneOrMore>
</g:production>

<!-- ] end TryCatchExpr -->
Expand Down Expand Up @@ -2628,6 +2626,7 @@ ErrorVal ::= "$" VarName
<g:choice name="DocumentTestBodyChoice">
<g:ref name="ElementTest"/>
<g:ref name="SchemaElementTest"/>
<g:ref name="NameTestUnion"/>
</g:choice>
</g:optional>
<g:string>)</g:string>
Expand Down
17 changes: 15 additions & 2 deletions specifications/xpath-functions-40/src/fos.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://www.w3.org/xpath-functions/spec/namespace"
xmlns:fos="http://www.w3.org/xpath-functions/spec/namespace"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1">
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<xs:attributeGroup name="diff-markup">
<xs:attribute name="diff" use="optional">
Expand Down Expand Up @@ -346,14 +346,27 @@
<xs:sequence>
<xs:element ref="fos:expression"/>
<xs:choice>
<xs:element ref="fos:result" minOccurs="1" maxOccurs="unbounded"/>
<xs:element ref="fos:result" minOccurs="1" maxOccurs="1"/>
<xs:element ref="fos:error-result"/>
</xs:choice>
<xs:element name="test-assertion" minOccurs="0" maxOccurs="1">
<!-- A 'result' element to be used in the generated test, for use in cases where the result as presented
in the spec cannot be used as-is in the test, for example because (a) it uses XQuery, or (b) because there
are variations documented in the postamble -->
<!-- We avoid bringing in the schema for the qt3 test suite because it's too much hassle. -->
<xs:complexType>
<xs:sequence>
<xs:any namespace="http://www.w3.org/2010/09/qt-fots-catalog" processContents="skip"/>
</xs:sequence>
<xs:assert test="local-name(*) eq 'result'"/>
</xs:complexType>
</xs:element>
<xs:element ref="fos:postamble" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="use" type="xs:IDREFS"/>
<xs:attribute name="default-collation" type="xs:anyURI"/>
<xs:attribute name="implicit-timezone" type="xs:duration"/>
<xs:attribute name="schema-aware" type="xs:boolean"/>
<xs:attribute name="xslt-version" type="xs:decimal"/>
<xs:attribute name="spec" default="XPath">
<xs:simpleType>
Expand Down
321 changes: 259 additions & 62 deletions specifications/xpath-functions-40/src/function-catalog.xml

Large diffs are not rendered by default.

39 changes: 31 additions & 8 deletions specifications/xpath-functions-40/src/xpath-functions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1415,9 +1415,7 @@ This includes all the built-in datatypes defined in <bibref ref="xmlschema-2"/>.
</tbody>
</table>
<?local-function-index?>
<div3 id="func-node-kind">
<head><?function fn:node-kind?></head>
</div3>

<div3 id="func-node-name">
<head><?function fn:node-name?></head>
</div3>
Expand Down Expand Up @@ -2540,6 +2538,11 @@ string conversion of the number as obtained above, and the appropriate <var>suff
<div2 id="random-numbers">
<head>Random Numbers</head>
<?local-function-index?>

<p>The function makes use of the record structure defined in the next section.</p>
<div3 id="random-number-generator-record">
<head><?record-description random-number-generator-record?></head>
</div3>
<div3 id="func-random-number-generator">
<head><?function fn:random-number-generator?></head>
</div3>
Expand Down Expand Up @@ -3537,11 +3540,12 @@ It is recommended that implementers consult <bibref ref="UNICODE-TR18"/> for inf

<?local-function-index?>

<p>The structured representation of a URI is described by the
<loc href="#uri-structure-record">uri-structure-record</loc>, whose parts are:</p>
<p>Both functions use a structured representation of a URI as defined in the next section.</p>

<?record-description uri-structure-record?>


<div3 id="uri-structure-record">
<head><?record-description uri-structure-record?></head>

<p>The segmented forms of the path and query parameters provide
convenient access to commonly used information.</p>

Expand All @@ -3566,6 +3570,7 @@ It is recommended that implementers consult <bibref ref="UNICODE-TR18"/> for inf
is repeated in the query string, the map will contain a
sequence of values for that key, as seen for <code>a</code>
in this example.</p>
</div3>

<div3 id="func-parse-uri">
<head><?function fn:parse-uri?></head>
Expand Down Expand Up @@ -7103,6 +7108,9 @@ Field 2A,Field 2B,Field 2C,Field 2D'



</div3>
<div3 id="parsed-csv-structure-record">
<head><?record-description parsed-csv-structure-record?></head>
</div3>
<div3 id="func-parse-csv">
<head><?function fn:parse-csv?></head>
Expand Down Expand Up @@ -7485,6 +7493,9 @@ return <table>
<p>The following functions allow dynamic loading and evaluation of XQuery queries, XSLT stylesheets,
and XPath binary operators.</p>
<?local-function-index?>
<div3 id="load-xquery-module-record">
<head><?record-description load-xquery-module-record?></head>
</div3>
<div3 id="func-load-xquery-module">
<head><?function fn:load-xquery-module?></head>
</div3>
Expand Down Expand Up @@ -7556,6 +7567,7 @@ return <table>
<item><p><termdef id="dt-key-value-pair-map" term="key-value pair map">A <term>key-value pair map</term> is a map containing two
entries, one (with the key <code>"key"</code>) containing the key part of a key value pair, the other (with the key <code>"value"</code>)
containing the value part of a key value pair.</termdef></p>
<p>The record type for a <termref def="dt-key-value-pair-map"/> is defined in <specref ref="key-value-pair"/>.</p>
<p>For example
the map <code>{ "x": 1, "y": 2 }</code> can be decomposed as
<code>({ "key": "x", "value": 1 }, { "key": "y", "value": 2 })</code></p>
Expand Down Expand Up @@ -7602,6 +7614,10 @@ return <table>
</tr>
</tbody>
</table>

<div3 id="key-value-pair">
<head><?record-description key-value-pair?></head>
</div3>

</div2>

Expand Down Expand Up @@ -9139,7 +9155,7 @@ return <table>
<p>The structured representation of a schema type is described by the
<loc href="#schema-type-record">schema-type-record</loc>, whose parts are:</p>

<?record-description schema-type-record?>
<p>?record-description schema-type-record?</p>

<note>
<p>Simple properties of a schema type that can be expressed as strings or booleans are
Expand All @@ -9158,9 +9174,16 @@ return <table>

<?local-function-index?>

<div3 id="schema-type-record">
<head><?record-description schema-type-record?></head>
</div3>

<div3 id="func-schema-type">
<head><?function fn:schema-type?></head>
</div3>
<div3 id="func-type-of">
<head><?function fn:type-of?></head>
</div3>
<div3 id="func-atomic-type-annotation">
<head><?function fn:atomic-type-annotation?></head>
</div3>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0"
xmlns="http://www.w3.org/2010/09/qt-fots-catalog"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:f="http://local.functions/"
xpath-default-namespace="http://www.w3.org/xpath-functions/spec/namespace"
exclude-result-prefixes="#all"
expand-text="yes">
Expand All @@ -13,7 +14,7 @@
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:key name="type-ref" match="type" use="@id"/>
<xsl:key name="type-ref" match="record-type" use="@id"/>

<xsl:template match="/">
<xsl:comment> ************************************************** </xsl:comment>
Expand Down Expand Up @@ -90,8 +91,8 @@
</xsl:template>

<xsl:template match="@type-ref | @return-type-ref">
<xsl:variable name="type" select="key('type-ref', .)"/>
<xsl:apply-templates select="$type/*"/>
<!-- For the moment, assume the named types will become built-in types in the fn namespace -->
<xsl:text>fn:{.}</xsl:text>
</xsl:template>

<xsl:template match="type/record">
Expand Down
25 changes: 17 additions & 8 deletions specifications/xpath-functions-40/style/generate-qt3-test-set.xsl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version='1.0'?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:x="http://www.w3.org/1999/XSL/TransformAlias" xmlns:s="http://saxon.sf.net/alias"
xmlns:saxon="http://saxon.sf.net/" xmlns:fos="http://www.w3.org/xpath-functions/spec/namespace"
xmlns:fos="http://www.w3.org/xpath-functions/spec/namespace"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/2010/09/qt-fots-catalog" exclude-result-prefixes="#all"
expand-text="true">

Expand All @@ -17,10 +17,8 @@
-t -xsl:style/generate-qt3-test-set.xsl -s:src/function-catalog.xml -val -o:/Users/mike/GitHub/qt4cg/qt4tests/app/fo-spec-examples.xml
-->

<xsl:namespace-alias result-prefix="xsl" stylesheet-prefix="x"/>
<xsl:namespace-alias result-prefix="saxon" stylesheet-prefix="s"/>

<xsl:output method="xml" indent="yes" saxon:double-space="test-case"
xmlns:saxon="http://saxon.sf.net/"
cdata-section-elements="assert-xml"/>

<xsl:param name="qt4tests-dir" static="yes" select="'../../../build/qt4tests/'"/>
Expand Down Expand Up @@ -50,6 +48,7 @@
<namespace prefix="map" uri="http://www.w3.org/2005/xpath-functions/map"/>
<namespace prefix="array" uri="http://www.w3.org/2005/xpath-functions/array"/>
<decimal-format name="ch" decimal-separator="&#xb7;" grouping-separator="&#x2b9;"/>
<decimal-format name="de" decimal-separator="," grouping-separator="."/>
<decimal-format name="fortran" exponent-separator="E"/>
</environment>

Expand Down Expand Up @@ -90,6 +89,10 @@
<xsl:if test="@spec = 'XQuery'">
<dependency type="spec" value="XQ40+"/>
</xsl:if>
<xsl:if test="xs:boolean(@schema-aware)">
<dependency type="feature" value="schemaImport"/>
<dependency type="feature" value="schemaValidation"/>
</xsl:if>
<test>
<xsl:for-each select="id(@use)">
{"let $" || @name || " := " || @select}
Expand All @@ -101,22 +104,28 @@
</test>
<result>
<xsl:choose>
<xsl:when test="fos:result[contains(., '&lt;')] and not(contains(fos:expression, 'serialize'))">
<xsl:when test="exists(fos:test-assertion)">
<xsl:copy-of select="fos:test-assertion/*:result/*"/>
</xsl:when>
<xsl:when test="fos:result[matches(., '^\s*&lt;')] and not(contains(fos:expression, 'serialize'))">
<!-- Drop leading whitespace to keep the XML parser happy -->
<xsl:variable name="trimmed" select="replace(fos:result, '^\s+&lt;', '&lt;')"/>
<xsl:choose>
<xsl:when test="fos:result/@normalize-space eq true()">
<xsl:variable name="stripped">
<xsl:try>
<xsl:apply-templates select="parse-xml(fos:result)" mode="strip-space"/>
<xsl:apply-templates select="parse-xml($trimmed)" mode="strip-space"/>
<xsl:catch>
<xsl:message expand-text="1">** Failure in parse-xml on fos:result of {$fos-function/@name}-{$n}</xsl:message>
<!--<xsl:message>:::{$trimmed}:::</xsl:message>-->
<substitute-for-unparseable-result-xml/>
</xsl:catch>
</xsl:try>
</xsl:variable>
<assert-xml ignore-prefixes="{(fos:result/@ignore-prefixes, false())[1]}">{serialize($stripped)}</assert-xml>
</xsl:when>
<xsl:otherwise>
<assert-xml ignore-prefixes="{(fos:result/@ignore-prefixes, false())[1]}">{fos:result}</assert-xml>
<assert-xml ignore-prefixes="{(fos:result/@ignore-prefixes, false())[1]}">{$trimmed}</assert-xml>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
Expand Down
63 changes: 41 additions & 22 deletions specifications/xpath-functions-40/style/merge-function-specs.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,6 @@
<def>
<xsl:copy-of select="$fspec/fos:signatures/(@diff, @at)"/>
<xsl:apply-templates select="$fspec/fos:signatures/fos:proto"/>
<xsl:for-each select="distinct-values($fspec/fos:signatures//(@type-ref|@return-type-ref))">
<xsl:call-template name="show-record-type">
<xsl:with-param name="name" select="."/>
<xsl:with-param name="definition" select="key('record-type', ., $fosdoc)"/>
<xsl:with-param name="is-first"
select="empty($fspec/preceding-sibling::fos:function[
fos:signatures//(@type-ref|@return-type-ref) = current()])"/>
</xsl:call-template>
</xsl:for-each>
<xsl:apply-templates select="$fspec/fos:signatures/fos:record"/>
</def>
</gitem>
<xsl:if test="$fspec/fos:properties">
Expand Down Expand Up @@ -235,6 +225,24 @@
</glist>
</xsl:template>

<xsl:template match="head[processing-instruction('record-description')]" expand-text="yes">
<xsl:variable name="lexname" select="processing-instruction('record-description')/normalize-space(.)"/>
<xsl:variable name="definition" select="$fosdoc/fos:functions/fos:record-type[@id = $lexname]"/>
<xsl:if test="empty($definition)">
<xsl:message terminate="yes">*** Record definition {$lexname} not found ***</xsl:message>
</xsl:if>
<head>Record fn:{$definition/@id}</head>
<xsl:apply-templates select="processing-instruction('record-description') (:$definition:)"/>
</xsl:template>

<xsl:template match="fos:record-type">
<xsl:call-template name="show-record-type">
<xsl:with-param name="name" select="@id"/>
<xsl:with-param name="definition" select="."/>
<xsl:with-param name="is-first" select="true()"/>
</xsl:call-template>
</xsl:template>

<xsl:function name="fos:use-two-column-format" as="xs:boolean">
<xsl:param name="examples" as="element(fos:examples)"/>
<xsl:sequence select="not(contains-token($examples/@role, 'wide'))
Expand Down Expand Up @@ -271,16 +279,19 @@
<xsl:param name="name" as="xs:string"/>
<xsl:param name="definition" as="element(fos:record-type)"/>
<xsl:param name="is-first" as="xs:boolean"/>
<eg>
<xsl:if test="$is-first">
<xsl:attribute name="id" select="$name"/>
</xsl:if>
<xsl:text>record {$name} (&#xa;</xsl:text>
<xsl:for-each select="$definition/fos:field">
<xsl:text> {@name}{if (xs:boolean(@required)) then "" else "?"} as {@type}{if (position() ne last()) then "," else ""}&#xa;</xsl:text>
</xsl:for-each>
<xsl:text>)&#xa;</xsl:text>
</eg>
<example role="record">
<record>
<xsl:if test="$is-first">
<xsl:attribute name="id" select="$name"/>
</xsl:if>
<!--<xsl:text>record {$name} (&#xa;</xsl:text>-->
<xsl:for-each select="$definition/fos:field">
<arg name="{@name}" type="{@type}" occur="{if (xs:boolean(@required)) then 'req' else 'opt'}"/>
<!--<xsl:text> {@name}{if (xs:boolean(@required)) then "" else "?"} as {@type}{if (position() ne last()) then "," else ""}&#xa;</xsl:text>-->
</xsl:for-each>
<!--<xsl:text>)&#xa;</xsl:text>-->
</record>
</example>
</xsl:template>

<xsl:template match="@dependency"> It depends on
Expand Down Expand Up @@ -555,7 +566,7 @@
</thead>
<tbody>
<xsl:for-each
select="following-sibling::*[starts-with(local-name(), 'div')][head/processing-instruction()]">
select="following-sibling::*[starts-with(local-name(), 'div')][head/processing-instruction('function')]">
<xsl:variable name="lexname" select="string(head/processing-instruction())"/>
<xsl:variable name="fspec"
select="fos:get-function(substring-before($lexname, ':'), substring-after($lexname, ':'))"/>
Expand All @@ -578,7 +589,8 @@
<xsl:template match="p[termdef[@role = 'placemarker']]"/>

<xsl:template match="processing-instruction(record-description)">
<xsl:variable name="target" select="key('record-type', string(.), $fosdoc)"/>
<xsl:variable name="record-name" select="normalize-space()"/>
<xsl:variable name="target" select="key('record-type', $record-name, $fosdoc)"/>
<xsl:if test="count($target) ne 1">
<xsl:message expand-text="yes">Failed to locate record type {.}</xsl:message>
</xsl:if>
Expand Down Expand Up @@ -616,6 +628,12 @@
</thead>
<tbody>
<xsl:apply-templates select="$record/fos:field" mode="narrative"/>
<xsl:if test="xs:boolean($record/@extensible)">
<tr>
<td><p><code>*</code></p></td>
<td><p>The record type is extensible (it may contain additional fields beyond those listed).</p></td>
</tr>
</xsl:if>
</tbody>
</table>

Expand Down Expand Up @@ -674,6 +692,7 @@
<p>
<code>
<xsl:value-of select="@key|@name"/>
<xsl:if test="not(xs:boolean(@required))">?</xsl:if>
</code>
</p>
</td>
Expand Down
Loading

0 comments on commit b32100d

Please sign in to comment.