This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The stylesheet contains several errors, e.g. referencing the context item within a stylesheet function. Proposed correction as follows. Another issue - the stylesheets "forgets" to handle the attribute 'memberTypes' - is dealt with in a separate bug report. With kind regards - Hans-Juergen Rennau <xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:f="http://www.w3.org/2008/05/XMLSchema-misc"> <xsl:param name="newTargetNamespace" as="xs:anyURI" required="yes"/> <xsl:param name="prefixForTargetNamespace" as="xs:NCName" select="f:generateUniquePrefix(., 0)"/> <xsl:template match="@*|node()"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> <xsl:template match="xs:schema"> <xsl:copy> <xsl:namespace name="{$prefixForTargetNamespace}" select="$newTargetNamespace"/> <xsl:apply-templates select="@*"/> <xsl:attribute name="targetNamespace" select="$newTargetNamespace"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="attribute(*, xs:QName) [namespace-uri-from-QName(.)='']"> <xsl:attribute name="{name()}" select="concat($prefixForTargetNamespace, ':', local-name-from-QName(.))"/> </xsl:template> <xsl:function name="f:generateUniquePrefix" as="xs:NCName"> <xsl:param name="xsd"/> <xsl:param name="try" as="xs:integer"/> <xsl:variable name="disallowed" select="distinct-values($xsd//*/in-scope-prefixes(.))"/> <xsl:variable name="candidate" select="xs:NCName(concat('p', $try))"/> <xsl:sequence select="if ($candidate = $disallowed) then f:generateUniquePrefix($xsd, $try+1) else $candidate"/> </xsl:function> </xsl:transform>
On the telcon on 2010-01-08 the WG decided to accept the suggested changes to the stylesheets, with a request to Sandy Gao to insert these changes into the status quo.
Created attachment 907 [details] revised stylesheet for chameleon include Attached is the revised form of the stylesheet, which is included in the new status-quo document at http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.html#chameleon-xslt (member-only link) I believe this resolves the issue, so I'm marking the issue RESOLVED. As the originator, Hans-Jürgen Rennau is invited to check that the corrections have been made correctly (it's always easy to mess something up) and indicate by either closing or reopening the issue that he is satisfied, or not satisfied, with the resolution of the issue. If the WG does not hear from you in the next two weeks or so, we will assume that you are satisfied. Thank you very much for catching the errors, and for providing the fixes.
(In reply to comment #2) Thank you, everything looks fine, I close the issue.