Hi,
It seems like you misinterpret xmlns to be an ordinary attribute. Instead it is
a namespace declaration for the element.
With your first template you create a new article element *with* namespace.
When the other elements of the input document are copied with your second
template no namespace is being added.
So the question is what you want:
1. Have all elements in that namespace -> add it in the second template as
well
2. Don’t use namespace at all -> remove xmlns from first template
Regards,
Patrik
Dr. Patrik Stellmann
Anwendungsarchitektur und Koordination
GDV Dienstleistungs-GmbH | Niederlassung Frankenstraße
Tel: +49(40)33449-1142
Fax: +49(40)33449-1400
E-Mail:
Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de<mailto:Patrik(_dot_)Stellmann(_at_)gdv-dl(_dot_)de>
GDV Dienstleistungs-GmbH
Glockengießerwall 1
D-20095 Hamburg
www.gdv-dl.de<http://www.gdv-dl.de>
Niederlassungen:
Wilhelmstraße 43 / 43 G
10117 Berlin
Frankenstraße 18
20097 Hamburg
Sitz und Registergericht: Hamburg
HRB 145291
USt.-IdNr : DE 205183123
Geschäftsführer:
Dr. Jens Bartenwerfer
Fred di Giuseppe Chiachiarella
Aufsichtsratsvorsitzender: Werner Schmidt
------------------------------------------------------------------
Diese E-Mail und alle Anhänge enthalten vertrauliche und/oder rechtlich
geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe der E-Mail ist nicht gestattet.
This e-mail and any attached files may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
Von: Joga Singh Rawat jrawat(_at_)aptaracorp(_dot_)com
[mailto:xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com]
Gesendet: Mittwoch, 4. September 2019 08:04
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] how to remove xmls=""
Dear Expert,
I am getting <front xmlns=""> and <body xmlns=""> as output from below
combination of input xml and xslt. Please let us know how to remove xmlns=””.
INPUT
<article
xmlns:mml="http://www.w3.org/1998/Math/MathML"<http://www.w3.org/1998/Math/MathML%22>
xmlns:xlink="http://www.w3.org/1999/xlink"<http://www.w3.org/1999/xlink%22>
xmlns:oasis="http://www.niso.org/standards/z39-96/ns/oasis-exchange/table"<http://www.niso.org/standards/z39-96/ns/oasis-exchange/table%22>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<http://www.w3.org/2001/XMLSchema-instance%22>
xmlns:ali="http://www.niso.org/schemas/ali/1.0/"<http://www.niso.org/schemas/ali/1.0/%22>
article-type="research-article" dtd-version="1.1" xml:lang="en">
<front>
...
</front>
<body>
...</body>
</article>
XSLT
<xsl:template match="article">
<article
xmlns="http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishing.xsd"<http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishing.xsd%22>>
<xsl:if test="@article-type">
<xsl:attribute name="article-type" select="@article-type"/>
</xsl:if>
<xsl:if test="@xml:lang">
<xsl:attribute name="xml:lang" select="@xml:lang"/>
</xsl:if>
<xsl:attribute
name="xsi:schemaLocation">http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd
http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd</xsl:attribute>
<xsl:apply-templates/>
</article>
</xsl:template>
<xsl:template match="node() | @*">
<xsl:copy copy-namespaces="no" inherit-namespaces="no">
<xsl:apply-templates select="node() | @*[not(name()='xmlns')]"/>
</xsl:copy>
</xsl:template>
OUTPUT
<article
xmlns="http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishing.xsd"<http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishing.xsd%22>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<http://www.w3.org/2001/XMLSchema-instance%22>
xmlns:mml="http://www.w3.org/1998/Math/MathML"<http://www.w3.org/1998/Math/MathML%22>
article-type="research-article"
xml:lang="en"
xsi:schemaLocation="http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd
http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd"<http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd%22>>
<front xmlns="">
...
</front>
<body xmlns="">
...
</body>
</article>
thanks in advance
...JSR
XSL-List info and archive<http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe<http://lists.mulberrytech.com/unsub/xsl-list/2718916> (by
email<>)
--~----------------------------------------------------------------
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
--~--