Dear All,
I am having following XML table:
<table frame="none">
<label>Table 2</label>
<caption>Sample for table alignmark.</caption>
<tgroup cols="4">
<colspec colnum="1" colname="col1" />
<colspec colnum="2" colname="col2" />
<colspec colnum="3" colname="col3" />
<colspec colnum="4" colname="col4" />
<thead>
<row>
<entry top="true" bottom="true">Variable</entry>
<entry align="center" top="true"
bottom="true">Mean
(<italic>Character alignment</italic>)</entry>
<entry align="center" top="true"
bottom="true">Median
(<bold>Alignmark</bold>)</entry>
<entry align="center" top="true" bottom="true">SD
(<bold>Alignmark</bold>)</entry>
</row>
</thead>
<tbody>
<row>
<entry top="true">Salary</entry>
<entry align="char" char="±"
top="true">160±170</entry>
<entry top="true">10<alignmark />.10</entry>
<entry top="true">a<alignmark /> bcde</entry>
</row>
<row>
<entry>Bonus</entry>
<entry align="char"
char="±">180±190</entry>
<entry>0<alignmark />.201</entry>
<entry>pq<alignmark />r stu</entry>
</row>
<row>
<entry>Optional Grants</entry>
<entry align="char"
char="±">100±110</entry>
<entry>1230<alignmark />.30</entry>
<entry>efg<alignmark /> hg</entry>
</row>
<row>
<entry>Stock return (%)</entry>
<entry align="char"
char="±">120±130</entry>
<entry>40<alignmark />.410</entry>
<entry><alignmark />df I</entry>
</row>
<row>
<entry>Standard return in (%) values</entry>
<entry align="char"
char="×">130×150</entry>
<entry>0<alignmark />.501</entry>
<entry>123</entry>
</row>
<row>
<entry>Age of CEO (years)</entry>
<entry align="char"
char="×">150×170</entry>
<entry>56<alignmark />.60</entry>
<entry>567</entry>
</row>
<row>
<entry bottom="true">SIC moves</entry>
<entry align="char" char="×"
bottom="true">170×180</entry>
<entry bottom="true">542<alignmark />.70</entry>
<entry bottom="true">789</entry>
</row>
</tbody>
</tgroup>
</table>
Note presence of alignmark tag. In which column this alignmark tag is
present, the corresponding <colspec> should be changed to <tb:colspec>
I tried to take the position of the entry which is having alignmark
tag but i am not getting it.
XSL Code:
<xsl:template match="colspec">
<xsl:variable name="enpos"
select="parent::tgroup/descendant::entry[alignmark]/position()"/>
<xsl:choose>
<xsl:when test="position() = $enpos">
<tb:colspec>
<xsl:copy-of select="@*"/>
</tb:colspec>
</xsl:when>
<xsl:otherwise>
<colspec>
<xsl:copy-of select="@*"/>
</colspec>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
In the output the tb namespace has been added for all colspec. But it
should apply only to 3rd and 4th colspec. Please suggest where i am
going wrong.
Regards,
Ganesh
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--