- From: G. Ken Holman <gkholman@CraneSoftwrights.com>
- Date: Wed, 21 Nov 2012 12:58:38 -0500
- To: xmlschema-dev@w3.org
At 2012-11-21 11:10 -0600, Loren Cahlander wrote:
>The current contents of the xs:element were not copied when the
>annotation was added.
Yep! You're right! There is one line missing. I hope the
stylesheet below helps. That's what I get for throwing something
together without testing it.
Please forgive my oversight.
. . . . . . Ken
p.s I haven't tested the stylesheet below either, but given your
evidence it is obvious that there is an <xsl:apply-templates/>
missing and so I've added it.
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">
<!--don't preserve any comments that are followed by element declarations-->
<xsl:template match="
comment()[following-sibling::node()[not(self::text())][1][self::xs:element]]">
<!--do nothing with this comment-->
</xsl:template>
<!--act on element declarations preceded by comments-->
<xsl:template match="
xs:element[preceding-sibling::node()[not(self::text())][1][self::comment()]]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xs:annotation>
<xs:documentation>
<xsl:value-of select="preceding-sibling::comment()[1]"/>
</xs:documentation>
</xs:annotation>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()"><!--identity for all other nodes-->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Received on Wednesday, 21 November 2012 17:59:13 UTC