Re: Does anyone have a transform to change comments into annotations in an existing schema?

Loren Cahlander <[email protected]> Wed, 21 Nov 2012 10:14:29 -0600
Newsgroups gmane.text.xml.schema.devel
Message-ID <[email protected]>
Thanks!  I will try that.



On Nov 21, 2012, at 10:03 AM, Ihe Onwuka <[email protected]> wrote:

> On Wed, Nov 21, 2012 at 4:01 PM, Ihe Onwuka <[email protected]> wrote:
>> On Wed, Nov 21, 2012 at 3:45 PM, Loren Cahlander
>> <[email protected]> wrote:
>>> I am looking to transform comments that precede an element and make those
>>> comments as an annotation for that element.
>>> 
>>> for example:
>>> 
>>> <!-- Information about foo -->
>>> <xs:element name="foo-group">
>>> .
>>> .
>>> .
>>> </xs:element>
>>> 
>>> 
>>> to
>>> 
>>> <xs:element name="foo-group">
>>> <xs:annotation>
>>>  <xs:documentation>Information about foo</xs:documentation>
>>> </xs:annotation>
>>> </xs:element>
>>> 
>> <xsl:stylesheet
>>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
>> <xsl:import href="identity.xsl"/>
>> <xsl:template match="comment()">
>>   <xs:annotation>
>>      <xsl:value-of select="."/>
>>   </xs:annotation>
>> </xsl:template>
> 
> include an identity stylesheet in the same directory as where you run
> the transform from.
>