0

I am creating a HTML <div> from a xsl file but the created div has the xmlns namespace declarations as attributes.

This is the dialed down version of my XSL file:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    
        xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"          xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
        xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
        xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"         
version="1.0">

    <xsl:template match="ab:cde">
        <div>
            <!-- some stuff here -->
        </div>
    </xsl:template>
</xsl:stylesheet>

The output div beight created is:

<div xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 
</div>

Can anyone suggest me a way to get rid of these namespace declarations from my div?

Thnx in advance!!

1 Answer 1

4

Use the exclude-result-prefixes attribute on the <xsl:stylesheet> element. In your case:

exclude-result-prefixes="w a r"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.