Reputation: 4054
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!!
Upvotes: 0
Views: 272
Reputation: 12075
Use the exclude-result-prefixes
attribute on the <xsl:stylesheet>
element. In your case:
exclude-result-prefixes="w a r"
Upvotes: 4