xsl-list
[Top] [All Lists]

[xsl] Trying to remove default namespace declaration in output

2019-03-05 09:46:21
I'm using XSLT to process DITA topics. This is a conversion/cleanup
effort to try and normalize our content before loading into a new CMS.
So basically doing an identity transformation with some random
modifications.

In the DTD is the definition xmlns:ditaarch
=
"http://dita.oasis-open.org/architecture/2005/";

This is the primary template that is doing the transformation

            
<xsl:template match
=
"node()"
 priority
=
"-10"


        

<xsl:copy>
            

<xsl:call-template name
=
"processAtrbiutes"
/>

            

<xsl:apply-templates select
=
"node()"
/>

        

</xsl:copy>
    

</xsl:template>

        And this is the template that I have handling the attributes

        <xsl:template
 name
=
"processAtrbiutes"


    
<xsl:for-each
 select
=
"./@*"


        
<xsl:choose>

            
<xsl:when
 test
=
"name(.) = 'class'"


                
<!-- Remove -->

            
</xsl:when>

            
<xsl:when
 test
=
"name(.) = 'domains'"


                
<!-- Remove -->

            
</xsl:when>

            
<xsl:when
 test
=
"local-name(.) = 'DITAArchVersion'"


                
<!-- Remove -->

            
</xsl:when>

            
<xsl:when
 test
=
"local-name(.) = 'ditaarch'"


                
<!-- Remove -->

            
</xsl:when>

            
<xsl:when
 test
=
"local-name(.) = 'ux-source-priority'"


                
<!-- Remove -->

            
</xsl:when>

            
<xsl:otherwise>

                
<xsl:attribute
 name
=
"{local-name(.)}"
 select
=
"."
/>

            
</xsl:otherwise>

        
</xsl:choose>

    
</xsl:for-each>

</xsl:template>

        Basically I want to copy the attributes in the XML file that have
been applied and remove anything that has a default in the DTD.

        I have the ditaarch test here that is doing no good, but the other
tests do what they are supposed to. For the namespace I tried
declaring this namespace on the <xsl:stylesheet> element and then
exclude it but that didn't work either.

        Any suggestions?

        ..dan
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>