I want to remove the <a>
tags in the following, but keep the children (to remove the hotspots):
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
<title>GRAPHICS_000</title>
<g id="C3DB0001" name="Background" type="layer"/>
<g id="C3DG0001" name="Drawing" type="layer">
<g transform="matrix(3.78095,0,0,3.78095,-0,1122.97)" stroke-width="0.35">
<path stroke="#000" d="M148.47,-204.86 C148.29,-204.83"/>
<path stroke="#000" stroke-width="0.18" d="M148.38,-203.2 "/>
</g>
</g>
<g id="C3DA0001" name="Axials" type="layer"/>
<g id="C3DC0001" name="Callouts" type="layer">
<a id="e884b23a2e34327fba7db5424d88ee54" name="20" type="grobject" xlink:href="#">
<path d="M431.06,269.22 L454.55,269.22 454.55,285.35 431.06,285.35 Z" fill="#fff" fill-opacity="0"/>
<g transform="matrix(3.78095,0,0,3.78095,-0,1122.97)" stroke-linejoin="miter">
<path stroke="#000" d="M117.12,-221.54 L121.44,-197.39"/>
<text fill="#000">20</text>
</g>
</a>
<a id="e7dc1641ea0314fed4e538136162aa6b.1" name="30" type="grobject" xlink:href="#">
<path d="M338.24,916 L361.73,916 361.73,932.13 338.24,932.13 Z" fill="#fff" fill-opacity="0"/>
<g transform="matrix(3.78095,0,0,3.78095,-0,1122.97)" stroke-width="0.18">
<path stroke="#000" d="M89.458,-54.741 L82.214,-82.997"/>
<text fill="#000">30</text>
</g>
</a>
</g>
<g id="C3DP0001" name="Panels" type="layer"/>
</svg>
Using Ant and <replaceregexp>
<replaceregexp match="<a[\s].*>|</a>" replace="" flags="gi">
<fileset dir="${dir}"/>
</replaceregexp>
did remove the <a>
tags but left unwanted blank lines:
<g id="C3DA0001" name="Axials" type="layer"/>
<g id="C3DC0001" name="Callouts" type="layer">
<path d="M431.06,269.22 L454.55,269.22 454.55,285.35 431.06,285.35 Z" fill="#fff" fill-opacity="0"/>
<g transform="matrix(3.78095,0,0,3.78095,-0,1122.97)" stroke-linejoin="miter">
<path stroke="#000" d="M117.12,-221.54 L121.44,-197.39"/>
<text fill="#000">20</text>
</g>
<path d="M338.24,916 L361.73,916 361.73,932.13 338.24,932.13 Z" fill="#fff" fill-opacity="0"/>
<g transform="matrix(3.78095,0,0,3.78095,-0,1122.97)" stroke-width="0.18">
<path stroke="#000" d="M89.458,-54.741 L82.214,-82.997"/>
<text fill="#000">30</text>
</g>
</g>
<g id="C3DP0001" name="Panels" type="layer"/>
By looking at this question
I changed it to:
<replaceregexp match="(\r?\n).*?<a[\s].*>\r?\n" replace="\1" flags="gi">
<fileset dir="${dir}"/>
</replaceregexp>
<replaceregexp match="(\r?\n).*?</a>\r?\n" replace="\1" flags="gi">
<fileset dir="${dir}"/>
</replaceregexp>
Which works, but surely there is a better way, as this is clunky and slow. I thought ANT and regex would be faster than XSLT 1.0, my other alternative.