I wrote:
> 5. Someone should check the effect of upgrading
> to 2.7.1 on the escapeXMLEntities template
> defined in utils.xsl and used in metadata.xsl -
> some of this escaping
> may need to be modified, or indeed may no
> longer be necessary. I can do this checking
> if someone can give me a search query (either
> on the example data or as a remote search)
> that would trigger that bit of the code.
OK, I had a look for myself. The "Hydrological basins"
sample metadata has an ampersand in the metadata. Switching
Xalan from 2.7.0 to 2.7.1 does _not_ alter the
display and editing of this metadata. (Phew.)
On looking at the code I can see why - the error in
Xalan that is fixed in version 2.7.1 is to do with ampersands
in attribute values, and the escapeXMLEntities template deals
with text nodes, and that worked correctly anyway.
But this did show up what might be considered
inconsistencies (or indeed, errors) in the presentation/editing
of metadata.
Try the following three things with the Hydrological
basins metadata while logged in as the "admin" user:
1. Bring up the "Default" view of the metadata,
and press the "Edit" button.
In the "OnLine resource" labelled
"Hydrological basins in Africa (Shapefile Format)",
observe the URL contains:
id=10 ampersand fname=basins.zip ampersand access=private
(If you use the browser's "View Source", you can see that
the ampersands are escaped in the value attribute of the
corresponding input element in the form's HTML because
of the escapeXMLEntities template,
but the browser renders them as raw ampersands.)
2. Press "Cancel", then press "XML view".
Copy and paste the metadata from the browser into
a file, and run your favourite XML parser on the file.
Ouch - it is not well-formed XML because there are
two unescaped ampersands!
Each ampersand should have been displayed in the browser as
ampersand amp semicolon.
3. Go back to the browser and press the
"Edit button". (You're now editing the metadata as "raw"
XML.) Search for "fname". Aha, the ampersands have
been correctly escaped in this view (because of the
escapeXMLEntities template).
Conclusions:
1. The "XML view" of the metadata can produce XML that
is not well-formed. That is surely an error, yes?
2. Editing in the Default view is different from editing
in the XML view - in the default view, ampersands are
not escaped; in the XML view, they are. An
inconsistency, but perhaps a reasonable one. But
this could be a "gotcha" for users.
--
Richard Walker
Software Improvements Pty Ltd
Phone: +61 2 6273 2055
Fax: +61 2 6273 2082
|