Note that there are some explanatory texts on larger screens.

plurals
  1. POXSLT and Java: Default Namespace XMLNS
    primarykey
    data
    text
    <p>I'm new to XSLT and I'm trying to transform one XML file into another one. My problem is that there is one namespace 'xmlns' without any prefix in the original xml file and when I transform it to another one through xslt then nothing happens but if I remove that xmlns namespace then it works out but actually I cannot modify the original .xml file since I'm bound to use that file only, so I have to keep xmlns in the original file as it is. So can anyone please suggest some modifications in my .xsl or java code to overcome this problem.</p> <p>My Original XML namespace looks like-</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;manifest identifier="eXeorm_sample4823c6301f29a89a4c1f" xmlns:ims="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &lt;/manifest&gt; </code></pre> <p>My desired xml is:</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;manifest identifier="eXescorm_quiz4823c6301f29a8419515" xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &lt;/manifest&gt; </code></pre> <p>My Modified XSLT-</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2" xmlns:ims="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt; &lt;xsl:template match="ims:manifest"&gt; &lt;/xsl:stylesheet&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload