@@ -51,7 +51,7 @@ when <code>%%expr1%%</code> is an atom, and to omit the surrounding <code>{{{ }
</p>
<p> While this abbreviation results quite handy it requires some care when using
record patterns. As we sais the general form of a record pattern is:
record patterns. As we said the general form of a record pattern is:
</p>
<sample><![CDATA[
<(%%p1%%) (%%p2%%)>%%p3%%
...
...
@@ -59,18 +59,77 @@ record patterns. As we sais the general form of a record pattern is:
<p>
and the same abbreviations as for expressions apply. In particular this means
that, say, the pattern <code><t (a)>_</code> stands for <code><(`t)
(a)>_</code>. Therefore while <code><t (a)>_</code> matches all the elements of
tag <code>t</code> (and captures in the varible <code>a</code> the attributes),
the pattern <code><(t) (a)>_</code> matches all XML elements (whatever their
tag is) and captures their tag in the variable <code>t</code> (and their
attributes in <code>a</code>). Another point to notice is that <code><t>_</code>
stands for <code><t ({})>_</code> (more precisely, for <code><(`t) ({})>_</code>). Since
<code>{}</code> is the open empty record type, then it matches all the records. Therefore
<code><t>_</code> matches all elements of tag <code>t</code> whatever they have whatever they have attributes or not. In the following we enumerate some simple examples to show what we explained:
(a)>_</code>. Therefore while <code><t (a)>_</code> matches all the elements
of tag <code>t</code> (and captures in the variable <code>a</code> the
attributes), the pattern <code><(t) (a)>_</code> matches all XML elements
(whatever their tag is) and captures their tag in the variable <code>t</code>
(and their attributes in <code>a</code>). Another point to notice is that
<code><t>_</code> stands for <code><t ({})>_</code> (more precisely, for
<code><(`t) ({})>_</code>). Since <code>{}</code> is the <i>open</i> empty
record type, then it matches all the records. Therefore <code><t>_</code>
matches all elements of tag <code>t</code> whatever they have whatever they have
attributes or not. In the following we enumerate some simple examples to show
what we explained. For that consider the following definitions for bibliographic data:
</p>
<sample><![CDATA[
type Biblio = [(Paper|Book)*]
type Paper = <paper isbn=?String year=String>[ Author+ Title Conference Url? ]
type Book = <bookisbn=String> [ Author+ Title Url? ]
type Author = <author>[ PCDATA ]
type Title = <title>[ PCDATA ]
type Conference = <conference>[ PCDATA ]
type Url = <url>[ PCDATA ]
]]></sample>
<p>
Let <code>bib</code> be of type <code>Biblio</code> then
</p>
<sample><![CDATA[
transform bib with
<book (a)> [ (x::(Any\Url)|_)* ] -> [ <book(a)> x ]
]]></sample>
<p>
returns the list of all books without their Url element.