My actual data is as follows :
<image name="101272.dcm">
<gobject type="Right"><polyline><vertex index="0" t="0.0" x="636.0" y="1920.0" z="0.0"/><vertex index="1" t="0.0" x="604.0" y="2296.0" z="0.0"/></polyline></gobject>
</image>
<image name="101280.dcm">
<gobject type="Right"><polyline><vertex index="0" t="0.0" x="1776.0" y="392.0" z="0.0"/><vertex index="1" t="0.0" x="1456.0" y="424.0" z="0.0"/></polyline></gobject>
</image>
I was successful in extracting all other data as required. But using the comma as delimiter is painful as Im a beginner in xslt.
Im using xslt version 2 and my code is :
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
seriesUID,annotationType,coordSys,data,name,label
<xsl:for-each select="//gobject">
<xsl:variable name="seriesUID" select="ancestor::image/@name"/>
<xsl:value-of select="substring-before($seriesUID,'.dcm')"/>
<xsl:value-of select="concat(',','polygon')"/>
<xsl:value-of select="@annotationType"/>
<xsl:value-of select="concat(',','Image')"/>
<xsl:value-of select="@coordSys"/>
<xsl:value-of select="concat(',','[')"/>
<xsl:for-each select="polyline/vertex">
<xsl:value-of select="concat('','[')"/>
<xsl:value-of select="@x"/>
<xsl:value-of select="@y"/>
<xsl:value-of select="@z"/>
<xsl:value-of select="concat(']','')"/>
</xsl:for-each>
<xsl:value-of select="concat(']','',',')"/>
<xsl:value-of select="@type"/>
<xsl:value-of select="concat(',','')"/>
<xsl:value-of select="@label"/>
<xsl:value-of select="concat(',','
')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Generating below output :
seriesUID annotationType coordSys data name label
1006780 polygon Image ["[3476.0,1196.0,0.0],"[3436.0,1036.0,0.0],] Right
1006810 polygon Image ["[3064.0,744.0,0.0],"[3300.0,912.0,0.0],] Right
Please help me eliminate the double quote marks and the last COMMA in the field data.