xml - XSLT : access grandchildren of given node -


i have following xml,

<doc>     <table type="horizontal lines" width="100%">              <group cols="5">                 <colspec colname="1" colwidth="58%"/>                 <colspec colname="2" colwidth="32%"/>                  <thead>                    <row>                       <entry namest="1" align="center">                          <p type="table head">testing table</p>                       </entry>                       <entry namest="2" align="center">                          <p type="table head">testing head</p>                       </entry>                    </row>                 </thead>                 <tbody>                    <row>                       <entry namest="1" align="left">                          <p type="table text">mobile os</p>                       </entry>                       <entry namest="2" align="left">                          <p type="table text">android</p>                       </entry>                    </row>                    <row>                       <entry namest="4" align="left">                          <p type="table text">                              <link type="hyperlink">www.facebook.com</link>                            </p>                          <p type="table text"/>                       </entry>                       <entry namest="4" align="left">                          <p type="table text">                              <link type="hyperlink">www.skynews.com</link>                            </p>                          <p type="table text"/>                       </entry>                    </row>             </tbody>       </group>     </table>     <para>       <entry namest="4" align="left">          <p type="table text">             <link type="hyperlink">www.devandroid.com</link>            </p>            <p type="table text">             <link type="hyperlink">www.google.com</link>            </p>          <p type="table text"/>       </entry>     </para> <doc> 

as can see there <link> nodes in document placed grandchildren of <table> node , and <link> nodes out of <table> nodes (no relationship <table> node. need convert <link> nodes text (which places grandchildren's of <table> nodes) in uppercase letter. (in example, <link type="hyperlink">www.facebook.com</link> , <link type="hyperlink">www.skynews.com</link> should capitalized.)

so, how can select <link> nodes within <table> node ?

i tried codes follows,but did not give result.

<xsl:template match="table::link">         <xsl:copy>             <xsl:copy-of select="@*"/>              more codes...         </xsl:copy>  </xsl:template> 

any suggestions how can access grandchildren's of table node ??

you can use following match pattern links in table (the default template rule links have lower priority):

<xsl:template match="link[ancestor::table]">    ... </xsl:template>  <xsl:template match="link">    ... </xsl:template> 

Comments