W3C home > Mailing lists > Public > public-xml-core-wg@w3.org > February 2007

XLink conversion stylesheet

From: Norman Walsh <Norman.Walsh@Sun.COM>
Date: Wed, 14 Feb 2007 10:51:13 -0500
To: public-xml-core-wg@w3.org
Message-ID: <871wksspou.fsf@nwalsh.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:35 GMT