Re: [xsl] How to strip off all <xsd:annotation> ...</xsd.annotation> tags

Subject: Re: [xsl] How to strip off all <xsd:annotation> ...</xsd.annotation> tags
From: "Ben Stover" <bxstover@xxxxxxxxxxx>
Date: Wed, 12 Aug 2009 14:09:18 +0200
Hi Martin,

thank you for your suggestion. Unfortunately your script show the following error (when running with Saxon):

Saxon from Saxonica
Java version 1.5.0_06
Warning: at xsl:stylesheet on line 5 column 18 of stripannotationtags.xsl:
  Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
Stylesheet compilation time: 390 milliseconds
Processing file:/D:/xslt/Saxon/strip%20annotation%20tags/testsource.xsd
Building tree for file:/D:/xslt/Saxon/strip%20annotation%20tags/testsource.xsd using class net.sf.saxon.tinytree.TinyBuilder
Tree built in 93 milliseconds
Tree size: 258 nodes, 3948 characters, 82 attributes
Loading net.sf.saxon.event.MessageEmitter
Error on line 10 of stripannotationtags.xsl:
  XTDE0410: An attribute node (targetNamespace) cannot be created after the children of the
  containing element
  at xsl:apply-templates (file:/D:/xslt/Saxon/strip%20annotation%20tags/stripannotationtags.xsl#11)
     processing /xsd:schema/@targetNamespace
  in built-in template rule
Transformation failed: Run-time errors were reported
Press any key to continue . . .

Do you know what's wrong?

On Wed, 05 Aug 2009 15:22:48 +0200, Martin Honnen wrote:

>Ben Stover wrote:
>> I would like to  strip off from a XSD schema file all annotation tags. In other words all elements
>> <xsd:annotation>
>> .....
>> </xsd:annotation>
>> should be eliminated from the XSD schema including when is inside such a tag.
>> How could I do this with a XSLT script?

>   <xsl:stylesheet
>      xmlns:xsl="";
>      xmlns:xsd="";
>      version="1.0">

>      <xsl:template match="xsd:annotation"/>

>      <xsl:template match="@* | node()">
>        <xsl:copy>
>          <xsl:apply-templates select="@* | node()"/>
>        </xsl:copy>
>      </xsl:template>

>   </xsl:stylesheet>


>	Martin Honnen

Current Thread