如何使用xslt转换为ArrowHeads将mif文件转换为svg

时间:2018-05-07 07:44:31

标签: java xml xslt svg framemaker

Expected output image output generated from xsl transformation

问题:我已用红色框标记。

我已经使用如下箭头的中间xml转换了mif文件。

示例箭头:< -

MIF:

<PolyLine 
   <Unique 1016926>
   <GroupID 12>
   <HeadCap Square>
   <HeadCap ArrowHead>
   <TailCap Square>
   <NumPoints 2>
   <Point  4.89138" 0.28317">
   <Point  4.18741" 0.28317">
  > # end of PolyLine

IntermediateXml:

<PolyLine>
<Unique keyword="1016926"></Unique>
<GroupID keyword="12"></GroupID>
<HeadCap keyword="Square"></HeadCap>
<HeadCap keyword="ArrowHead"></HeadCap>
<TailCap keyword="Square"></TailCap>
<NumPoints keyword="2"></NumPoints>
<Point keyword=" 440.212460688 25.485696437999998"></Point>
<Point keyword=" 376.856850216 25.485696437999998"></Point>
</PolyLine>

第二个样本箭头: - &gt;

mif:

  <PolyLine 
   <Unique 1016991>
   <GroupID 12>
   <PenWidth  0.7 pt>
   <HeadCap Square>
   <HeadCap ArrowHead>
   <TailCap Square>
   <NumPoints 2>
   <Point  4.18887" 0.53202">
   <Point  4.52617" 0.53202">
  > # end of PolyLine

intermediateXml

<PolyLine>
<Unique keyword="1016991"></Unique>
<GroupID keyword="12"></GroupID>
<PenWidth keyword=" 0.7 pt"></PenWidth>
<HeadCap keyword="Square"></HeadCap>
<HeadCap keyword="ArrowHead"></HeadCap>
<TailCap keyword="Square"></TailCap>
<NumPoints keyword="2"></NumPoints>
<Point keyword=" 376.988246712 47.88254482800001"></Point>
<Point keyword=" 407.344437192 47.88254482800001"></Point>
</PolyLine>

第3个示例箭头: &LT; - &GT;

MIF:

<PolyLine 
   <Unique 1016992>
   <GroupID 12>
   <HeadCap Square>
   <HeadCap ArrowHead>
   <TailCap Square>
   <TailCap ArrowHead>
   <NumPoints 2>
   <Point  4.19177" 0.78086">
   <Point  4.52907" 0.78086">
  > # end of PolyLine

intermediateXml:

<PolyLine>
<Unique keyword="1016992"></Unique>
<GroupID keyword="12"></GroupID>
<HeadCap keyword="Square"></HeadCap>
<HeadCap keyword="ArrowHead"></HeadCap>
<TailCap keyword="Square"></TailCap>
<TailCap keyword="ArrowHead"></TailCap>
<NumPoints keyword="2"></NumPoints>
<Point keyword=" 377.24923975200005 70.278493204"></Point>
<Point keyword=" 407.605430232 70.278493204"></Point>
</PolyLine>

对于这3个样本箭头我需要svg输出。下面我尝试了svg输出,但是不正确。

对于&lt; - arrowhead SVG尝试输出:

<defs>
 <marker id="startarrow" markerWidth="10" markerHeight="7" refX="-0" refY="3.5" 
 orient="auto">
 <polygon points="10 0, 10 7, 0 3.5" fill="#000000"/>
 </marker>

 <marker id="endarrow" markerWidth="10" markerHeight="7" refX="8" refY="3.5" 
 orient="auto">
 <polygon points="0 0, 10 3.5, 0 7" fill="#000000"/>
 </marker>
</defs>

<polyline id="line1016926" gid="12" fill="none" fill-opacity="1" fill-rule="nonzero" stroke="#000000" marker-start="url(#startarrow)" points="440.212460688,25.485696437999998 376.856850216,25.485696437999998"/>

0 个答案:

没有答案