Dynamically add default xml namespace in my result xml through xslt 1.0

DLSteven

New Member
My result xml would be like this:\[code\]<bpmn:extensionElements> <ProcessAnalysisData xmlns="http:/paf/0.1"> <Scenario id="_0"> <ScenarioParameters> <Duration> <DurationParameter value="http://stackoverflow.com/questions/10946011/P8760D" /> </Duration> </ScenarioParameters> .....\[/code\]In xslt I have done this\[code\]<bpmn:extensionElements> <ProcessAnalysisData> <xsl:attribute name="xmlns"> <xsl:value-of select="$prmPafNamespace"/> </xsl:attribute> <Scenario> <xsl:attribute name="id"> <xsl:value-of select="concat('_', $prmSimulationRunId)" /> </xsl:attribute> <ScenarioParameters> ....\[/code\]But this dont work because we cant use attribute named 'xmlns'. How can I add default namespace in my (process analysis data) node? uri in \[code\]prmPafNamespace\[/code\] can be changed, thats why I am not hard coding default namespace. I hope you understand the question. I have done the above work using\[code\] <xsl:element name="ProcessAnalysisData" namespace="{$prmPafNamespace}">\[/code\]but it is not suitable because it creates xmlns="" empty attribute to child elements like in result xml\[code\]<ProcessAnalysisData xmlns="http:/paf/0.1"> <Scenario id="_0" xmlns="">\[/code\]To remove xmlns="" I have to use namespace attribute in every child element node...Is there any other alternative to remove this issue.
 
Back
Top