XLink conversion stylesheet

I believe this XSLT 1.0 stylesheet converts XLink 1.0 to XLink 1.1:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:xlink="http://www.w3.org/1999/xlink"
                version="1.0">

<xsl:output method="xml"/>

<xsl:preserve-space elements="*"/>

<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*"/>
    <xsl:if test="@xlink:href and not(@xlink:type)">
      <xsl:attribute name="xlink:type">simple</xsl:attribute>
    </xsl:if>
    <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

<xsl:template match="comment()|processing-instruction()|text()">
  <xsl:copy/>
</xsl:template>

</xsl:stylesheet>

Note that this does the right thing for XLink 1.0 documents that rely
on defaulted attributes in the DTD because they will automatically be
preserved. (The DTD will add them so XSLT will see them so XSLT will
write them out.)

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Wednesday, 14 February 2007 15:51:48 UTC