Hussey
Hussey

Reputation: 127

define Namespace with prefix in child nodes in xslt

Is there any way to define (namespace with prefix) in child node of xml using xslt. so that my namespace apply to its decendents also, i have use

<xsl:element name="abc" namespace="{$prmPafNamespace}"> 

but it create default namespace.

when i use it like below

<xsl:element name="paf:abc" namespace="{$prmPafNamespace}">
    <xsl:element name="paf:child_abc"/>
</xsl:element>

then it gives error that 'paf' is not defined, how to solve this issue...

Upvotes: 0

Views: 317

Answers (2)

Martin Honnen
Martin Honnen

Reputation: 167726

You need to define the namespace on each element e.g.

<xsl:element name="paf:abc" namespace="{$prmPafNamespace}">
    <xsl:element name="paf:child_abc" namespace="{$prmPafNamespace}"/>
</xsl:element>

Upvotes: 1

O. R. Mapper
O. R. Mapper

Reputation: 20780

You can try adding an xmlns:paf="{$prmPafNamespace}" attribute to your document/element, but I'm not sure whether it will work with a dynamic namespace URI.

Upvotes: 0

Related Questions