If your doing a reg implementation here is a couple of ways of doing the
translation. I recently tested the xsl and seems to work fine,
currently doing template matches on the xs:IDREF and xs:ID attributes,
which seems to be (id, idref, frame_id, coord_system_id) let me know if
I have missed other attributes.
XSL (sample of @id translates characters to '_' that are not allowed for xs:ID it also should catch resubmits in case a user edits&submits the xml with the identifier already part of the 'id'. Also note there are probably still a few characters to be translated to '_' that are possible from the reg identifier currently did the most commonly seen.)
<xsl:template match="@id">
<xsl:variable name="valofattr" select="." />
<xsl:variable name="valofident"
select="translate(substring(../../../identifier,7),'.+-/','____')" />
<xsl:variable name="valofattrsub"
select="substring($valofattr,1,string-length($valofident))" />
<xsl:attribute name="id">
<xsl:if
test="contains(namespace-uri(..),'http://www.ivoa.net/xml/STC')">
<xsl:if test="(string-length($valofattrsub) = 0) or
(string-length($valofattrsub) < string-length($valofident)) or
(not(contains($valofident,$valofattrsub)))">
<xsl:value-of select="$valofident" /><xsl:text>_</xsl:text></xsl:if></xsl:if><xsl:value-of select="$valofattr"/>
</xsl:attribute>
</xsl:template>
XSL2.0 and pattern replacing. If your doing other languages then
probably you can do simple string replacement with an expression same
goes with xsl and the replace function.
Here is a sample of a Java one that I used in the past and suspect it
should work for other language:
tempIdent.replaceAll("[^\\w*]","_"); //replace all characters that are
not a 'word' character to "_"
Ray Plante wrote:
> On Wed, 3 Jan 2007, Patrick Dowler wrote:
>> Can we just pick one separator rather than two optional ones? >
> >> Does this mean >> these separators should not (cannot) be used within authority id or >> resource >> key or coordsys key? >
>
>