RE: Fwd: [MODS] MADS: XML schema for authorities

Hi Stefano

> but in the MADS schema you get
>
>   ...
>   <xsd:attribute name="relatedType" use="optional">
>   ...

> so, if the attribute is not present, the XML is legal, but the 
> stylesheet wouldn't work.

I hadn't intended the stylesheet to be complete, just to illustrate how you
could do this. If relatedType is missing, you could either make up a general
property that is a superclass of broader, narrower or other related or use a
property that has the same meaning such as skos:semanticRelation or
rdfs:seeAlso instead e.g.

<xsl:template match="ref">
     <xsl:choose>
      <xsl:when test="@relatedType">
       <xsl:element name="{@relatedType}" 
namespace="http://web.mit.edu/simile/www/2004/06/mads-custom#">
         <xsl:call-template name="refcommon"/>
       </xsl:element>
      </xsl:when>
      <xsl:otherwise>
        <rdfs:seeAlso>
         <xsl:call-template name="refcommon"/>
        </rdfs:seeAlso>
      </xsl:otherwise>
     </xsl:choose>
</xsl:template>

<xsl:template name="refcommon">
     <rdf:Description>
       <xsl:choose>
         <xsl:when test="geographic">
           <xsl:attribute 
name="rdf:about">http://web.mit.edu/simile/www/2004/06/madsdata#<xsl:value-o
f 
select="str:urlencode(geographic)"/></xsl:attribute>
         </xsl:when>
         <xsl:when test="topic">
           <xsl:attribute 
name="rdf:about">http://web.mit.edu/simile/www/2004/06/madsdata#<xsl:value-o
f 
select="str:urlencode(topic)"/></xsl:attribute>
         </xsl:when>
       </xsl:choose>
     <xsl:apply-templates/>
     </rdf:Description>
</xsl:template>

Mark

Received on Monday, 7 June 2004 11:52:51 UTC