[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

position of entry with respect to its row

Subject: position of entry with respect to its row
From: Ganesh Babu N <nbabuganesh@xxxxxxxxx>
Date: Thu, 9 Jul 2009 10:21:54 +0530
 position of entry with respect to its row
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="&#x00B1;"
top="true">160&#x00B1;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="&#x00B1;">180&#x00B1;190</entry>
                               <entry>0<alignmark />.201</entry>
                               <entry>pq<alignmark />r stu</entry>
                       </row>
                       <row>
                               <entry>Optional Grants</entry>
                               <entry align="char"
char="&#x00B1;">100&#x00B1;110</entry>
                               <entry>1230<alignmark />.30</entry>
                               <entry>efg<alignmark /> hg</entry>
                       </row>
                       <row>
                               <entry>Stock return (%)</entry>
                               <entry align="char"
char="&#x00B1;">120&#x00B1;130</entry>
                               <entry>40<alignmark />.410</entry>
                               <entry><alignmark />df I</entry>
                       </row>
                       <row>
                               <entry>Standard return in (%) values</entry>
                               <entry align="char"
char="&#x00D7;">130&#x00D7;150</entry>
                               <entry>0<alignmark />.501</entry>
                               <entry>123</entry>
                       </row>
                       <row>
                               <entry>Age of CEO (years)</entry>
                               <entry align="char"
char="&#x00D7;">150&#x00D7;170</entry>
                               <entry>56<alignmark />.60</entry>
                               <entry>567</entry>
                       </row>
                       <row>
                               <entry bottom="true">SIC moves</entry>
                               <entry align="char" char="&#x00D7;"
bottom="true">170&#x00D7;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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.