Lassen Sie nicht benötigte Namespaces aus der Ausgabe aus

Mein XSLT gibt einige Tags mit ausxmlns:x="http://something" Attribut ... Wie vermeide ich dieses redundante Attribut? Das Ausgabe-XML wird niemals verwendet, auch nicht in einemx:tag, noch in einemx:attribute.

XML-BEISPIEL:

<root><p>Hello</p><p>world</p></root>

BEISPIEL FÜR XSL:

<xsl:transform version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
   xmlns:xlink="http://www.w3.org/1999/xlink">
<xsl:output encoding="UTF-8" method="xml" version="1.0" indent="no"/>

<xsl:template match="root"><foo>
   <xsl:for-each select="p">
    <p><xsl:value-of select="." /></p>
   </xsl:for-each></foo>
   <xsl:for-each select="x">
    <link xlink:href="{x}" />
   </xsl:for-each></foo>
</xsl:template>

BEISPIEL FÜR XML-AUSGABE:

<foo>
   <p xmlns:xlink="http://www.w3.org/1999/xlink">Hello</p>
   <p xmlns:xlink="http://www.w3.org/1999/xlink">world</p>
</foo>

Dasxmlns:xlink ist ein Aufwand, der nicht genutzt wird!

Ein typischer Fall Dabei muss XSLT den Namespace verwenden, die Ausgabe jedoch nicht:

 <xsl:value-of select="php:function('regFunction', . )" />

Antworten auf die Frage(2)

Ihre Antwort auf die Frage