XSLT transform XML with default namespace without adding prefix?

前端 未结 3 1410
走了就别回头了
走了就别回头了 2021-02-15 17:31

I am trying to transform an XML file with the following namespace, but couldn\'t find out a way to make it working with the default namespace without adding a prefix to the outp

3条回答
  •  猫巷女王i
    2021-02-15 18:17

    You simply need to define your default namespace in the XSLT. If you also define one with a prefix as well so you can select items from the input XML with ease:

    
      
        ...
      ...
    

    The above template will match against your input XML element - and the literal element created will be in the default output namespace (which is the same namespace).

    Of course you should be aware that in XML the prefix is irrelevant - two items are identical if they have the same namespace and local name, even if the two prefixes are defined for that one namespace.

    
    
    

    The two elements above are the same because they have the same fully qualified name.

提交回复
热议问题