Re: Must variables that contain maps be typed?

Norman Tovey-Walsh <[email protected]>
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
Ihe Onwuka <[email protected]> writes:
> <xsl:variable name="actions" >
>       <xsl:map>
>             etc
>      </xsl:map>
> </xsl:variable>
>
> Doesn't seem right to me.

As I recall, if you initialize a variable with a sequence constructor
(content instead of a select attribute), then you are constructing a
tree unless you specify a type.

So, 

  <xsl:variable name="actions" select="map { … }"/>

would be fine, but to use xsl:map, you have to specify the type:

  <xsl:variable name="actions" as="map(*)">
       <xsl:map>
             etc
      </xsl:map>
  </xsl:variable>

You could argue that the processor ought to be able to tell that the
result is going to be a map, but keeping the rule simple means that
there’s no possible ambiguity if someone constructs something that could
be a map or could be a tree.

                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <[email protected]>
https://nwalsh.com/

> There is hopeful symbolism in the fact that flags do not wave in a
> vacuum.--Arthur C. Clarke

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE1ury//rzuvqf7fN/hVWfHhJMAHkFAl86m+sACgkQhVWfHhJM
AHmrxg/9ELjs29JBkMyqsTR+8tqo3E+eWQcsPVa7Sxh78E51j877HWr+EzK5lQIO
eFltwIjmTar/xRRezy5l8mlr+JqLs+wJ5KAaZ5u804tU5e7oWu7FEPuxtgCUon+g
6RNjcXxOzmtmvL7jN5ec2VwiQmV4T0H7qBY71Kqe/IPDnXFovVT8g9Nalnw4I/Dq
//C+XvPnTHdMfSbM7V5E0cH8ARsjpRtD1y49HFi1Amek1C95aapUQdFH3Z3gfTXn
uj1SKpWcOWIy2asXk98ShneD9ykL9bUzwCtZIjbOXh3PJ+VGO3kmKV6ikRiRDP3X
ydfT2xj0wJqjSmG/4E0shGWUO7GeZ8Fj2UUoAI1bQ2xeeDFW7GIXgx5cEuGNbM/8
+C+SnkFcknaDdrvPuQhW5+TuOq9oy3YfIiGSwr5CWz5j6jSKs7YJx/TZWfAqB+T3
fXQBCbekXgUJZd1JfymXhSgFqGEgLTDes9cbPWyTWzeMR5X3PiUPdlQ0d7MoRyT1
MuR0vWKsxL5m5JK143gyaDdifdehEnWKu01Nh+Gg9KG2OXt5IY2txMf8+m9FjzXS
4rCJFL1IgNuX12zQAsGvwIud4/esyagJs2L5ApJYRalbot3FJYKLD2BOhIUyH+h/
HOVoYoZeVyQ1/hjhP9JaYjUwXqCUSdMytAp3ALuYgYrKa7fLvtw=
=a/qt
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.