Using XSLT 1.0 to insert element in middle of XML List -


i have xml 1.0 document need transform xslt 1.0 file. xml need transform looks this:

<commandbardata guid="f3016f3c-2847-4557-b61a-a2d05319cf18">   <menubar>     <modedata guid="76d73481-9076-44c9-821c-52de9408cce2">       <item guidref="0f948c18-f326-40e5-9beb-2efc73803797"/>       <item guidref="6c91d5ab-d648-4364-96fb-3e71bcfaf70d"/>       <item guidref="71f8ffd6-46bd-43a3-8256-5412bc2d7741"/>       <item guidref="ac291790-gf51-d4s1-f23x-dsf9dfb6fgf5"/>     </modedata>   </menubar> </commandbardata> 

i need insert <item guidref="21c1f231-e03e-48e8-916a-d8790442b417"/> after element <item guidref="0f948c18-f326-40e5-9beb-2efc73803797"/>

so list this:

<commandbardata guid="f3016f3c-2847-4557-b61a-a2d05319cf18">   <menubar>     <modedata guid="76d73481-9076-44c9-821c-52de9408cce2">       <item guidref="0f948c18-f326-40e5-9beb-2efc73803797"/>       <item guidref="21c1f231-e03e-48e8-916a-d8790442b417"/>       <item guidref="6c91d5ab-d648-4364-96fb-3e71bcfaf70d"/>       <item guidref="71f8ffd6-46bd-43a3-8256-5412bc2d7741"/>       <item guidref="ac291790-gf51-d4s1-f23x-dsf9dfb6fgf5"/>     </modedata>   </menubar> </commandbardata> 

how do using xslt 1.0?

i have made several attempts , have code working. 1 issue remaining how insert element after. code below works except...

<xsl:template match="uiconfig/commandbars">    <xsl:copy>      <xsl:apply-templates select = "node()|@*" />   </xsl:copy> </xsl:template>  <xsl:template  

match="uiconfig/commandbars/commandbardata/menubar/modedata/item[@guidref='0f948c18-f326-40e5-9beb-2efc73803797']">

it generates xml:

<item guidref="0f948c18-f326-40e5-9beb-2efc73803797"><item guidref="21c1f231-e03e-48e8-916a-d8790442b417" xmlns:frmwrk="corel framework data" /></item>       <item guidref="21c1f231-e03e-48e8-916a-d8790442b417" />       <item guidref="6c91d5ab-d648-4364-96fb-3e71bcfaf70d" />       <item guidref="71f8ffd6-46bd-43a3-8256-5412bc2d7741" />       <item guidref="ac291790-gf51-d4s1-f23x-dsf9dfb6fgf5" /> 

how make append after element , not insert child?

this solution worked:

<xsl:template match="uiconfig/commandbars/commandbardata/menubar/modedata/item[@guidref='0f948c18-f326-40e5-9beb-2efc73803797']">   <xsl:copy>       <xsl:apply-templates select="node()|@*" />   </xsl:copy>   <item guidref="21c1f231-e03e-48e8-916a-d8790442b417"/> </xsl:template> 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -