- From: Michael Smith via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 07 Jul 2010 08:58:17 +0000
- To: public-html-commits@w3.org
Update of /sources/public/html5/spec-author-view/tools
In directory hutz:/tmp/cvs-serv13921/tools
Added Files:
flag-frags-complete.xsl flag-frags.xsl
Log Message:
unbreak fragment-ID links in the author edition so that they point to the full spec instead
--- NEW FILE: flag-frags-complete.xsl ---
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" version="1.0">
<xsl:include href="../fragment-links.xsl"/>
<xsl:output method="html" indent="no"/>
<xsl:key name="local-frags" match="." use="concat('#',@id)"/>
<xsl:key name="filename-map" match="." use="h:li"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="a[@href[starts-with(.,'#')]]">
<xsl:variable name="ref" select="@href"/>
<xsl:choose>
<xsl:when test="not(key('local-frags',$ref))">
<xsl:message>
<xsl:value-of select="$ref"/>
</xsl:message>
<xsl:variable name="filename">
[...5776 lines suppressed...]
<li>syntax</li>
</ul>
<ul>
<li>#content-categories</li>
<li>content-models</li>
</ul>
<ul>
<li>#browsing-context-names</li>
<li>browsers</li>
</ul>
<ul>
<li>#submit-button-state</li>
<li>number-state</li>
</ul>
<ul>
<li>#concept-select-option-list</li>
<li>the-button-element</li>
</ul>
</div>
</xsl:stylesheet>
--- NEW FILE: flag-frags.xsl ---
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude"
version='1.0'>
<xsl:include href="../fragment-links.xsl"/>
<xsl:output method="html" indent="no"/>
<xsl:key name="local-frags" match="." use="concat('#',@id)"/>
<xsl:key name="filename-map" match="." use="h:li"/>
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="a[@href[starts-with(.,'#')]]">
<xsl:variable name="ref" select="@href"/>
<xsl:choose>
<xsl:when test="not(key('local-frags',$ref))">
<xsl:message>
<xsl:value-of select="$ref"/>
</xsl:message>
<xsl:variable name="filename">
<xsl:call-template name="get-filename">
<xsl:with-param name="ref" select="$ref"/>
</xsl:call-template>
</xsl:variable>
<a>
<xsl:copy-of select="@*"/>
<xsl:attribute name="href">
<xsl:value-of select="concat('http://dev.w3.org/html5/spec/',$filename,'.html',$ref)"/>
</xsl:attribute>
<xsl:attribute name="class">full-spec-link</xsl:attribute>
<xsl:attribute name="title">
<xsl:text>Read about this "</xsl:text>
<xsl:value-of select="normalize-space(.)"/>
<xsl:text>" reference in the full HTML5 spec.</xsl:text>
</xsl:attribute>
<xsl:apply-templates/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="get-filename">
<xsl:param name="ref"/>
<xsl:for-each select="document('')">
<xsl:value-of select="key('filename-map',$ref)/*[2]"/>
</xsl:for-each>
</xsl:template>
<xi:include href="../fragment-links.html"/>
</xsl:stylesheet>
Received on Wednesday, 7 July 2010 08:58:19 UTC