xml - select parent of a tag with XSLT -


i want select parent of xmi tag in for-each loop. here's input :

<xmi xmi.version='1.2' xmlns:uml="org.omg.xmi.namespace.uml">     <xmi.content>         <uml:model xmi.id='eee_1045467100313_135436_1' name='data'>             <uml:namespace.ownedelement>                 <uml:package xmi.id='_9_0_bc102e5_1427365805826_580042_23'                     name='migration2'>                  <uml:package xmi.id='_9_0_bc102e5_1427365805826_580042_22'                     name='migration'>                     <uml:class xmi.id='_9_0_bc102e5_1427367042666_255023_151'                         name='employee'>                         <uml:classifier.feature>                             <uml:attribute xmi.id='_9_0_bc102e5_1427367052819_893122_168'                                 name='cin'>                             </uml:attribute>                         </uml:classifier.feature>                     </uml:class>                     <uml:class xmi.id='_9_0_bc102e5_1427367042666_255023_152'                         name='employee2'>                         <uml:classifier.feature>                             <uml:attribute xmi.id='_9_0_bc102e5_1427367052819_893122_169'                                 name='cin2'>                             </uml:attribute>                         </uml:classifier.feature>                     </uml:class>                     <uml:class xmi.id='_9_0_bc102e5_1427367042666_255023_153'                         name='employee3'>                         <uml:classifier.feature>                             <uml:attribute xmi.id='_9_0_bc102e5_1427367052819_893122_170'                                 name='cin3'>                             </uml:attribute>                         </uml:classifier.feature>                     </uml:class>                  </uml:package>               </uml:package>             </uml:namespace.ownedelement>         </uml:model>     </xmi.content> </xmi> 

so select uml:package xslt use select option of for-each loop :

<xsl:for-each                     select="xmi/xmi.content/uml:model/uml:namespace.ownedelement/uml:package">                     <packagedelement>                         <xsl:attribute name="xmi:type">uml:package</xsl:attribute>                         <xsl:attribute name="xmi.id">                         <xsl:value-of select='@xmi.id' />                     </xsl:attribute>                         <xsl:attribute name="name">                         <xsl:value-of select='@name' />                     </xsl:attribute> </xsl:for-each> 

is there possibility replace

select="xmi/xmi.content/uml:model/uml:namespace.ownedelement/uml:package"

ps : i've tried */uml:package , ../uml:package didn't work out . ?

for selecting uml:package elements, can write

select="//uml:package" 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -