Sign In/My Account | View Cart  
advertisement

Article:
 Template Languages in XSLT
Subject: Namespace Issues
Date: 2003-12-10 10:26:52
From: John Timm

I want the output of the transform to be fully-compliant XHTML. The only way to do this seems to be to make the default namespace of the transform that of XHTML strict. The <xsl:element> method of copying elements from the source tree to the result tree doesn't preserve the default namespace of the template document even if I have a root element of:


<html xmlns="http://www.w3.org/1999/xhtml" xmlns:my="http://xml.com/my-template-language" xml:lang="en" lang="en">


I can I do this without losing the genericity of the transform (output agnostic).


Thanks,


JT


Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • Namespace Issues
    2005-11-30 00:56:53 tkk

    A bit late, but I recently had the same issue as John Timm in creating an identity transform XSLT - to preserve the namespace of the original document elements in the output document you need to add a "namespace" attribute to your <xsl:element>, eg instead of:
    <xsl:element name="{name()}">
    use:


    <xsl:element name="{name()}" namespace="{namespace-uri()}">


    Hope that helps someone out there!


Sponsored By: