Re: [xsl] how to remove xmls=""

Subject: Re: [xsl] how to remove xmls=""
From: "Amrendra Kumar Gupta amrendra858@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 Sep 2019 07:34:20 -0000
one thing i try that adding a default namespace in xsl:stylesheet and got
this error resolved. Please try once like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema/xs";
   * xpath-default-namespace="http://www.w3.org/2001/XMLSchema/xs
<http://www.w3.org/2001/XMLSchema/xs>"*
    exclude-result-prefixes="xs"
    version="2.0">


    <xsl:template match="article">
        <article xmlns="
http://specifications.silverchair.com/xsd/1/18/SCJATS-journalpublishing.xsd
">
            <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>



</xsl:stylesheet>
_________________
Regards,
Amrendra Kr. Gupta
8588817220


On Wed, Sep 4, 2019 at 11:51 AM Dr. Patrik Stellmann
patrik.stellmann@xxxxxxxxx <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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
>
>
>
> *GDV Dienstleistungs-GmbH*
> GlockengieCerwall 1
> D-20095 Hamburg
> 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:* [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=bb.
>
>
>
> INPUT
>
> <article xmlns:mml="http://www.w3.org/1998/Math/MathML"; xmlns:xlink="
> http://www.w3.org/1999/xlink"; xmlns:oasis="
> http://www.niso.org/standards/z39-96/ns/oasis-exchange/table"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xmlns:ali="
> http://www.niso.org/schemas/ali/1.0/"; 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";
> >
>
>         <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";
>
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
>          xmlns:mml="http://www.w3.org/1998/Math/MathML";
>
>          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";
> >
>
>    <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/3279967> (by
> email <>)

Current Thread