1

次のファイル XML があります。

<?xml version="1.0" encoding="UTF-8"?>
<parent>
    <child1>
        <node>
                .... node attributes 
        </node>            
        <node>
                .... node attributes 
        </node>            
        <subchild1>
            <node>
                    .... node attributes 
            </node>            
            <subchild1>
            </child1>
            <child2>
                <node>
                .... node attributes 
                </node>            
                ....
            </child2>
.....
</parent>

任意の数のノード。属性を持つ要素ノードは 1 つだけです。他のすべての要素は階層を維持するために必要です。

xml を次のように変換する必要があります。

<?xml version="1.0" encoding="UTF-8"?>
<parent>         
   <node>
     <path>parent\child1</path>
     .... node attributes 
   </node>            
   <node>
     <path>parent\child2</path>
     .... node attributes 
   </node>            
   <node>
     <path>parent\child1\subchild1</path>
     .... node attributes 
   </node>            
   .....
 </parent>

つまり、ノード タイプの要素をリストに展開し、各要素に属性 [path] を追加します。属性は、階層内のノードのパスを示します。

この技術は、XSLT バージョン 2.0 で使用される予定です。

4

0 に答える 0