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. Donbt use namespace at all -> remove xmlns from first template
Regards,
Patrik
Dr. Patrik Stellmann
Anwendungsarchitektur und Koordination
GDV Dienstleistungs-GmbH | Niederlassung FrankenstraCe
Tel: +49(40)33449-1142
Fax: +49(40)33449-1400
E-Mail: Patrik.Stellmann@xxxxxxxxx<mailto:Patrik.Stellmann@xxxxxxxxx>
GDV Dienstleistungs-GmbH
GlockengieCerwall 1
D-20095 Hamburg
www.gdv-dl.de<http://www.gdv-dl.de>
Niederlassungen:
WilhelmstraCe 43 / 43 G
10117 Berlin
FrankenstraCe 18
20097 Hamburg
Sitz und Registergericht: Hamburg
HRB 145291
USt.-IdNr : DE 205183123
GeschC$ftsfC<hrer:
Dr. Jens Bartenwerfer
Fred di Giuseppe Chiachiarella
Aufsichtsratsvorsitzender: Werner Schmidt
------------------------------------------------------------------
Diese E-Mail und alle AnhC$nge enthalten vertrauliche und/oder rechtlich
geschC<tzte Informationen. Wenn Sie nicht der richtige Adressat sind oder
diese E-Mail irrtC<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@xxxxxxxxxxxxxx
[mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx]
Gesendet: Mittwoch, 4. September 2019 08:04
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: 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=bb.
INPUT
<article
xmlns:mml="http://www.w3.org/1998/Math/MathML"<http://www.w3.org/1998/Math/Ma
thML%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"<ht
tp://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-journalpublishin
g.xsd"<http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishin
g.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/SCJA
TS-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-journalpublishin
g.xsd"<http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishin
g.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/199
8/Math/MathML%22>
article-type="research-article"
xml:lang="en"
xsi:schemaLocation="http://specifications.silverchair.com/xsd/1/19/S
CJATS-journalpublishing.xsd
http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd"<
http://specifications.silverchair.com/xsd/1/19/SCJATS-journalpublishing.xsd%2
2>>
<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<>)
|