Unable to copy and modify attribute in XSLT when using a namespace

后端 未结 2 1694
梦如初夏
梦如初夏 2021-01-23 13:57

I\'m trying to transform an XML document and modify the attributes of single element but the transform is not getting applied if the root element has a namespace attribute. Simp

2条回答
  •  孤独总比滥情好
    2021-01-23 14:44

    xmlns works such that all nodes inherit the xmlns attribute(s) from their parent. What that means is, unless otherwise specified, when your document root contains xmlns="http://www.oracle.com/biee/bi-domain" it applies that namespace to all of the sub tree.

    So you're actually looking for a SecurityOptions tag with a namespace of "http://www.oracle.com/biee/bi-domain".

    This means that your XSLT will actually need to have something like this:

    
    

    at the top and the template match would look like this:

    
    

    Note the tmp: matches the xmlns:tmp; this is called a namespace prefix and allows xml to match the small string of tmp to the large string of "http://www.oracle.com/biee/bi-domain".

提交回复
热议问题