Question

Locked

transform from tree of attributes to tree of elements

By metinhoclam ·
<body lang=EN-US style='tab-interval:.5in'>

<div class=WordSection1>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>I have the XML source file in SVG present like this:</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>-------------------</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'<span class=SpellE><span class=GramE>svg</span></span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><g id='a001' class='pools'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>  <g id='b001' class='pool' name='Proc111'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>      <g id='c001' class='lane'
name='User111' <span class=SpellE>PoolID</span>='b001'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>         <g id='d001'
class='<span class=SpellE>startevent</span>' name='startevent111' <span
class=SpellE>LaneID</span>='c001'></g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>      </g>    </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>      <g id='c002' class='lane'
name='User222' <span class=SpellE>PoolID</span>='b001'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>          <g id='d002'
class='gateway' name='gateway111' <span class=SpellE>LaneID</span>='c001'></g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>      </g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>    </g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>    <g id='b002' class='pool' name='Proc222'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>      <g id='c003' class='lane' name='
customer ' <span class=SpellE>PoolID</span>=' b002'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>         <g id='d003'
class='<span class=SpellE>endevent</span>' name='endevent111' <span
class=SpellE>LaneID</span>='c003'><span class=GramE>  <</span>/g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>     </g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   </g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'></g></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'></<span class=SpellE>svg</span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>----------------</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><span class=SpellE><span class=GramE>i</span></span> <span
class=SpellE>wanna</span> <span class=SpellE>tranform</span> to target XML
document as following document:</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>-----------------</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><process id='a001' name='proc111'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <<span class=SpellE><span class=GramE>laneset</span></span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <span style='mso-spacerun:yes'> </span><lane
name='User111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <span style='mso-spacerun:yes'> </span><lane
name='User222'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> </<span class=SpellE>laneset</span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <<span class=SpellE>startevent</span> id='d001'
name='startevent111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <gateway id='d002' name='gateway111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'></process></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <process id='a002' name='proc222'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <<span class=SpellE><span class=GramE>laneset</span></span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>  <span style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'> </span><lane name='customer'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> </<span class=SpellE>laneset</span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <<span class=SpellE>endevent</span> id='d003'
name='endevent111'/> </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'></process></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>-----------</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>I have transformed by using call-template (<span class=SpellE>lanesettemplate<span
class=GramE>,starteventtemplate,endeventtemplate</span></span>..). And the
unexpected result like this:</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>----------</p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><process id='a001' name='proc111'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <span style='mso-spacerun:yes'> </span<span class=SpellE><span
class=GramE>laneset</span></span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <span style='mso-spacerun:yes'> </span><lane
name='User111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <span style='mso-spacerun:yes'> </span><lane
name='User222'/>  </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>  </<span class=SpellE>laneset</span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><span style='mso-spacerun:yes'> </span<span class=SpellE><span
class=GramE>laneset</span></span>>   <lane name='customer'/>
</<span class=SpellE>laneset</span>span style='mso-spacerun:yes'>
</span><!--- this element doesn?t belong to ?proc111?--></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>  <<span class=SpellE>startevent</span> id='d001'
name='startevent111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><span style='mso-spacerun:yes'> </span> <gateway id='d002'
name='gateway111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'></process></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <process id='a002' name='proc222'></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <<span class=SpellE><span class=GramE>laneset</span></span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>  <span style='mso-spacerun:yes'> </span><lane
name='User111'/<span class=GramE>!---</span> this element doesn?t
belong to ?proc222?--></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <span style='mso-spacerun:yes'> </span><lane
name='User222'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><span style='mso-spacerun:yes'> </span></<span class=SpellE>laneset</span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>   <<span class=SpellE><span class=GramE>laneset</span></span>>  
<lane name='customer'/> </<span class=SpellE>laneset</span>/p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <<span class=SpellE>startevent</span> id='d001'
name='startevent111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <gateway id='d002' name='gateway111'/></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> <<span class=SpellE>endevent</span> id='d003'
name='endevent111'/> </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'></process></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'> </p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>Anybody help me to give the best solutions for this transformation? My
problem is receiving the wrong child elements/attributes inside the parent
nodes. <span style='mso-spacerun:yes'> </span>Could I use the node-set to
declare the tree node from the source document? <span class=GramE>Or the other
way?</span></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'><o> </o></p>

<p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
normal'>Thank a lot!</p>

</div>

</body>

</html>

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

I could help a little.

by seanferd In reply to transform from tree of at ...

But it would probably help if you checked your post. Oddly, this is the second time today that I've seen someone who works with a markup language unable to post code in a forum.
<textarea rows=30 cols="60">
<html><body>
<xmp>
I have the XML source file in SVG present like this:<br><br><svg><br><g id='a001' class='pools'><br> <g id='b001' class='pool' name='Proc111'><br> <g id='c001' class='lane' name='User111' PoolID='b001'><br> <g id='d001' class='startevent' name='startevent111' LaneID='c001'></g><br> </g> <br> <g id='c002' class='lane' name='User222' PoolID='b001'><br> <g id='d002' class='gateway' name='gateway111' LaneID='c001'></g><br> </g><br> </g><br> <g id='b002' class='pool' name='Proc222'><br> <g id='c003' class='lane' name=' customer ' PoolID=' b002'><br> <g id='d003' class='endevent' name='endevent111' LaneID='c003'> </g><br> </g><br> </g><br></g><br></svg><br>----------------<br>i wanna tranform to XML target as following document:<br>-----------------<br><process id='a001' name='proc111'><br> <laneset><br> <lane name='User111'/><br> <lane name='User222'/><br> </laneset><br> <startevent id='d001' name='startevent111'/><br> <gateway id='d002' name='gateway111'/><br></process><br><br> <process id='a002' name='proc222'><br> <laneset><br> <lane name='customer'/><br> </laneset><br> <endevent id='d003' name='endevent111'/> <br></process><br>I transformed by call-template(lanesettemplate,starteventtemplate,endeventtemplate..). And the result like this:<br><process id='a001' name='proc111'><br> <laneset><br> <lane name='User111'/><br> <lane name='User222'/><br> <laneset> <lane name='customer'/> </laneset><br> </laneset><br> <startevent id='d001' name='startevent111'/><br> <gateway id='d002' name='gateway111'/><br></process><br><br> <process id='a002' name='proc222'><br> <lane name='User111'/><br> <lane name='User222'/><br> <laneset> <lane name='customer'/> </laneset><br> <startevent id='d001' name='startevent111'/><br> <gateway id='d002' name='gateway111'/><br> <endevent id='d003' name='endevent111'/> <br></process><br>Anybody help me? Thank a lot!
</xmp>
</body></html>
</textarea>
<br>

I won't try to format it any further. Your turn.

Back to Desktop Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums