Hi all,
I'm attempting to do a transform on an XML document. My XML transform can result in two different types of base element depending on the value of a certain element:
<xsl:template match="/">
<xsl:choose>
<xsl:when test="/databean/data[@id='pkhfeed']/value/text()='200'">
<xsl:call-template name="StructureA">
<xsl:with-param name="structure" select="//databean" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="StructureB">
<xsl:with-param name="structure" select="//databean" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
StructureA or StructureB are then created with their own namespaces and schemaLocations:
<StructureA xmlns="http://...">
StructureA & B share some common elements so these are defined in a separate file called "xmlcommon.xslt" that both structures include templates from. This xmlcommon file doesn't have a default namespace defined as I want it to be useable from the namespace defined in either StructureA or StructureB. But when I run my transform, any templates pulled in from the common file result in blank xmlns attributes:
<StructureA xmlns="http://...">
<SharedElement xmlns="">Something</SharedElement>
</StructureA>
When validating, the blank namespace is then used instead of the correct parent one. Does anyone know how I can stop my templates in my common file from adding those blank xmlns attributes?
Here's an snippet from the common file:
<xsl:stylesheet version="1.0" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="ControlledListStructure">
<xsl:param name="xmlElem" />
<xsl:param name="structure" />
<xsl:element name="{$xmlElem}">
<!-- Blah blah blah -->
</xsl:element>
</xsl:template>
</xsl:stylesheet>