From: <nw...@us...> - 2006-10-24 12:52:38
|
Revision: 6380 http://svn.sourceforge.net/docbook/?rev=6380&view=rev Author: nwalsh Date: 2006-10-24 05:52:28 -0700 (Tue, 24 Oct 2006) Log Message: ----------- Fixed bug #1568417: duplicate schematron rules Modified Paths: -------------- trunk/docbook/relaxng/docbook/docbook/Makefile trunk/docbook/relaxng/tools/augment.xsl trunk/docbook/relaxng/tools/schematron.xsl Modified: trunk/docbook/relaxng/docbook/docbook/Makefile =================================================================== --- trunk/docbook/relaxng/docbook/docbook/Makefile 2006-10-24 09:16:51 UTC (rev 6379) +++ trunk/docbook/relaxng/docbook/docbook/Makefile 2006-10-24 12:52:28 UTC (rev 6380) @@ -31,8 +31,9 @@ docbook.dtd: $(basename $(docbook_BINARY)).dtx docbook.rnc ../tools/xml2dtd.xsl $(XSLTPROC) -output $@ $(TOOLS)/xml2dtd.xsl $< +# N.B. the schematron stylesheet is an XSLT 2.0 stylesheet! docbook.sch: $(basename $(docbook_BINARY)).rnx - $(XSLTPROC) --output $@ $(TOOLS)/schematron.xsl $< + saxon $< $(TOOLS)/schematron.xsl $@ docbook.xsd: docbook.dtd $(RUNTRANG) $< $@ Modified: trunk/docbook/relaxng/tools/augment.xsl =================================================================== --- trunk/docbook/relaxng/tools/augment.xsl 2006-10-24 09:16:51 UTC (rev 6379) +++ trunk/docbook/relaxng/tools/augment.xsl 2006-10-24 12:52:28 UTC (rev 6380) @@ -79,23 +79,30 @@ <xsl:for-each select="$exclusions/ctrl:exclusion[ctrl:from[*[name(.)=$name]]]"> <xsl:for-each select="ctrl:exclude/*"> - <!-- - <xsl:message> - <xsl:value-of select="name(.)"/> - <xsl:text> is excluded from </xsl:text> - <xsl:value-of select="$name"/> - </xsl:message> - --> + <xsl:variable name="ename" select="name(.)"/> + <xsl:if test="($name != 'table' or name(.) != 'table') + and not(preceding-sibling::*[name(.) = $ename])"> + <!-- tables can't be excluded from themselves because HTML tables may nest --> + <!-- don't output duplicate names, even if they occur in the list --> - <s:pattern name="Element exclusion"> - <s:rule context="db:{$name}"> - <s:assert test="not(.//db:{name(.)})"> + <!-- + <xsl:message> <xsl:value-of select="name(.)"/> - <xsl:text> must not occur in the descendants of </xsl:text> + <xsl:text> is excluded from </xsl:text> <xsl:value-of select="$name"/> - </s:assert> - </s:rule> - </s:pattern> + </xsl:message> + --> + + <s:pattern name="Element exclusion"> + <s:rule context="db:{$name}"> + <s:assert test="not(.//db:{name(.)})"> + <xsl:value-of select="name(.)"/> + <xsl:text> must not occur in the descendants of </xsl:text> + <xsl:value-of select="$name"/> + </s:assert> + </s:rule> + </s:pattern> + </xsl:if> </xsl:for-each> </xsl:for-each> Modified: trunk/docbook/relaxng/tools/schematron.xsl =================================================================== --- trunk/docbook/relaxng/tools/schematron.xsl 2006-10-24 09:16:51 UTC (rev 6379) +++ trunk/docbook/relaxng/tools/schematron.xsl 2006-10-24 12:52:28 UTC (rev 6380) @@ -2,7 +2,7 @@ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.ascc.net/xml/schematron" xmlns:db="http://docbook.org/ns/docbook" - version="1.0"> + version="2.0"> <xsl:output method="xml" encoding="utf-8" indent="yes"/> <xsl:strip-space elements="*"/> @@ -11,10 +11,39 @@ <s:schema> <s:ns prefix="db" uri="http://docbook.org/ns/docbook"/> - <xsl:apply-templates select="//s:pattern"/> + <xsl:for-each-group select="//s:pattern" group-by="@name"> + <xsl:sort data-type="text" order="ascending"/> + + <s:pattern name="{current-grouping-key()}"> + + <xsl:for-each-group select="current-group()/s:rule" group-by="@context"> + <xsl:sort data-type="text" order="ascending"/> + + <s:rule context="{current-grouping-key()}"> + + <xsl:for-each-group select="current-group()/s:assert" group-by="@test"> + <xsl:sort data-type="text" order="ascending"/> + + <xsl:apply-templates select="current-group()[1]"/> + </xsl:for-each-group> + </s:rule> + </xsl:for-each-group> + </s:pattern> + </xsl:for-each-group> </s:schema> </xsl:template> + <xsl:template match="s:pattern"> + <xsl:variable name="context" select="s:rule[1]/@context"/> + + <xsl:message>pattern for <xsl:value-of select="$context"/></xsl:message> + + <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> + <xsl:copy-of select="@*"/> + <xsl:apply-templates/> + </xsl:element> + </xsl:template> + <xsl:template match="*"> <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}"> <xsl:copy-of select="@*"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |